[FFmpeg-devel] [PATCH] lavu/error: fix sign error in av_sterror() error code

Stefano Sabatini stefasab at gmail.com
Fri Jun 1 23:46:56 CEST 2012


The value returned by strerror_r may be positive depending on the system,
so it is necessary to use AVERROR() in order to get a negative
number. This way the successive negative check will not fail, and the
function will print a correct value on the buffer.
---
 libavutil/error.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/libavutil/error.c b/libavutil/error.c
index b1f8be5..16c2587 100644
--- a/libavutil/error.c
+++ b/libavutil/error.c
@@ -64,7 +64,7 @@ int av_strerror(int errnum, char *errbuf, size_t errbuf_size)
 #else
         ret = -1;
 #endif
-        if (ret < 0)
+        if (AVERROR(ret) < 0)
             snprintf(errbuf, errbuf_size, "Error number %d occurred", errnum);
     }
 
-- 
1.7.5.4



More information about the ffmpeg-devel mailing list