comparison 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
comparison
equal deleted inserted replaced
914:66b39cb91dde 915:a1a27468a9c5
34 if (errstr) { 34 if (errstr) {
35 av_strlcpy(errbuf, errstr, errbuf_size); 35 av_strlcpy(errbuf, errstr, errbuf_size);
36 } else { 36 } else {
37 #if HAVE_STRERROR_R 37 #if HAVE_STRERROR_R
38 ret = strerror_r(AVUNERROR(errnum), errbuf, errbuf_size); 38 ret = strerror_r(AVUNERROR(errnum), errbuf, errbuf_size);
39 #else
40 snprintf(errbuf, errbuf_size, "Error number %d occurred", errnum);
41 #endif 39 #endif
40 if (!HAVE_STRERROR_R || ret < 0)
41 snprintf(errbuf, errbuf_size, "Error number %d occurred", errnum);
42 } 42 }
43 43
44 return ret; 44 return ret;
45 } 45 }