summaryrefslogtreecommitdiffstats
path: root/common/common.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/common.c')
-rw-r--r--common/common.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/common/common.c b/common/common.c
index 449c95be26..4c1f9f327a 100644
--- a/common/common.c
+++ b/common/common.c
@@ -20,6 +20,7 @@
#include <assert.h>
#include <libavutil/common.h>
+#include <libavutil/error.h>
#include "talloc.h"
#include "misc/bstr.h"
@@ -243,3 +244,11 @@ bool mp_append_escaped_string(void *talloc_ctx, bstr *dst, bstr *src)
}
return false;
}
+
+// Behaves like strerror()/strerror_r(), but is thread- and GNU-safe.
+char *mp_strerror_buf(char *buf, size_t buf_size, int errnum)
+{
+ // This handles the nasty details of calling the right function for us.
+ av_strerror(AVERROR(errnum), buf, buf_size);
+ return buf;
+}