avformat: Print error message on failure of ff_rename()

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2014-10-25 13:04:18 +02:00
parent eeb9242b62
commit 92d366f6ab
3 changed files with 13 additions and 9 deletions

View file

@ -378,11 +378,15 @@ int ff_generate_avci_extradata(AVStream *st);
* @param newpath destination path
* @return 0 or AVERROR on failure
*/
static inline int ff_rename(const char *oldpath, const char *newpath)
static inline int ff_rename(const char *oldpath, const char *newpath, void *logctx)
{
if (rename(oldpath, newpath) == -1)
return AVERROR(errno);
return 0;
int ret = 0;
if (rename(oldpath, newpath) == -1) {
ret = AVERROR(errno);
if (logctx)
av_log(logctx, AV_LOG_ERROR, "failed to rename file %s to %s\n", oldpath, newpath);
}
return ret;
}
/**