[FFmpeg-cvslog] av_tempfile: fix error codes

Michael Niedermayer git at videolan.org
Sun Oct 16 21:55:12 CEST 2011


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun Oct 16 21:27:20 2011 +0200| [482aabd59a9da807e88fc7796b0764290b62cf11] | committer: Michael Niedermayer

av_tempfile: fix error codes

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=482aabd59a9da807e88fc7796b0764290b62cf11
---

 libavutil/file.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavutil/file.c b/libavutil/file.c
index e73e8ef..e2cfc2f 100644
--- a/libavutil/file.c
+++ b/libavutil/file.c
@@ -146,7 +146,7 @@ int av_tempfile(const char *prefix, char **filename) {
     /* -----common section-----*/
     if (*filename == NULL) {
         av_log(NULL, AV_LOG_ERROR, "ff_tempfile: Cannot allocate file name\n");
-        return -1;
+        return AVERROR(ENOMEM);
     }
 #if !HAVE_MKSTEMP
 #   ifndef O_BINARY
@@ -166,8 +166,9 @@ int av_tempfile(const char *prefix, char **filename) {
 #endif
     /* -----common section-----*/
     if (fd < 0) {
+        int err = AVERROR(errno);
         av_log(NULL, AV_LOG_ERROR, "ff_tempfile: Cannot open temporary file %s\n", *filename);
-        return -1;
+        return err;
     }
     return fd; /* success */
 }



More information about the ffmpeg-cvslog mailing list