diff --git a/libavformat/internal.h b/libavformat/internal.h index de4b784634..e76ac12371 100644 --- a/libavformat/internal.h +++ b/libavformat/internal.h @@ -541,8 +541,11 @@ static inline int ff_rename(const char *oldpath, const char *newpath, void *logc 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: %s\n", oldpath, newpath, av_err2str(ret)); + if (logctx) { + char err[AV_ERROR_MAX_STRING_SIZE] = {0}; + av_make_error_string(err, AV_ERROR_MAX_STRING_SIZE, ret); + av_log(logctx, AV_LOG_ERROR, "failed to rename file %s to %s: %s\n", oldpath, newpath, err); + } } return ret; }