[PATCH 4/6] Make log_errno() use av_strerror() rather than strerror(), which is not thread-safe.

Stefano Sabatini stefano.sabatini-lala
Sun Apr 25 19:35:51 CEST 2010


---
 libavdevice/v4l2.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c
index 0ece623..b1b1b4e 100644
--- a/libavdevice/v4l2.c
+++ b/libavdevice/v4l2.c
@@ -151,10 +151,13 @@ static struct fmt_map fmt_conversion_table[] = {
 
 static void log_errno(void *log_ctx, const char *fmt, ...)
 {
+    char errbuf[128];
     va_list vl;
+
+    av_strerror(AVERROR(errno), errbuf, sizeof(errbuf));
     va_start(vl, fmt);
     av_vlog(log_ctx, AV_LOG_ERROR, fmt, vl);
-    av_log(log_ctx, AV_LOG_ERROR, ": %s\n", strerror(errno));
+    av_log(log_ctx, AV_LOG_ERROR, ": %s\n", errbuf);
     va_end(vl);
 }
 
-- 
1.7.0


--nFreZHaLTZJo0R7j--



More information about the ffmpeg-devel mailing list