diff error.c @ 915:a1a27468a9c5 libavutil

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.
author stefano
date Mon, 03 May 2010 21:56:21 +0000
parents 71ebc8b18666
children 2860cc0b5562
line wrap: on
line diff
--- a/error.c	Thu Apr 29 14:41:20 2010 +0000
+++ b/error.c	Mon May 03 21:56:21 2010 +0000
@@ -36,9 +36,9 @@
     } 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;