summaryrefslogtreecommitdiff
path: root/libavutil/error.c
diff options
context:
space:
mode:
authorStefano Sabatini <stefano.sabatini-lala@poste.it>2010-05-03 21:56:21 +0000
committerStefano Sabatini <stefano.sabatini-lala@poste.it>2010-05-03 21:56:21 +0000
commit441ea0ce91d9df7e653c7a9598a62f230cf808c0 (patch)
tree43e3af316d02d84b3f0c43332679c09296cfe1d9 /libavutil/error.c
parent17d5959998c4f523abb4fde0dd0bb7df562219d8 (diff)
Make av_strerror() print an error message mentioning the error code
number if strerror_r() did not succeed for whatever reason. This avoids the need for the application to fill the string in case strerror_r() fails, for example because the error code is not known. Originally committed as revision 23015 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavutil/error.c')
-rw-r--r--libavutil/error.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavutil/error.c b/libavutil/error.c
index a1a0b87a9e..3dd38a351c 100644
--- a/libavutil/error.c
+++ b/libavutil/error.c
@@ -36,9 +36,9 @@ int av_strerror(int errnum, char *errbuf, size_t errbuf_size)
} else {
#if HAVE_STRERROR_R
ret = strerror_r(AVUNERROR(errnum), errbuf, errbuf_size);
-#else
- snprintf(errbuf, errbuf_size, "Error number %d occurred", errnum);
#endif
+ if (!HAVE_STRERROR_R || ret < 0)
+ snprintf(errbuf, errbuf_size, "Error number %d occurred", errnum);
}
return ret;