summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-11-26 21:21:56 +0100
committerDiogo Franco (Kovensky) <diogomfranco@gmail.com>2015-01-25 17:00:14 +0900
commitf24b8cbd47a9e75c635b1537aff16de18d350021 (patch)
tree621b05d169fdd9010ab58e4e7b467710efdb4da5 /video
parentb7061982079f33217e3d44f10d9892257f47c7ca (diff)
downloadmpv-f24b8cbd47a9e75c635b1537aff16de18d350021.tar.bz2
mpv-f24b8cbd47a9e75c635b1537aff16de18d350021.tar.xz
Do not call strerror()
...because everything is terrible. strerror() is not documented as having to be thread-safe by POSIX and C11. (Which is pretty much bullshit, because both mandate threads and some form of thread-local storage - so there's no excuse why implementation couldn't implement this in a thread-safe way. Especially with C11 this is ridiculous, because there is no way to use threads and convert error numbers to strings at the same time!) Since we heavily use threads now, we should avoid unsafe functions like strerror(). strerror_r() is in POSIX, but GNU/glibc deliberately fucks it up and gives the function different semantics than the POSIX one. It's a bit of work to convince this piece of shit to expose the POSIX standard function, and not the messed up GNU one. strerror_l() is also in POSIX, but only since the 2008 standard, and thus is not widespread. The solution is using avlibc (libavutil, by its official name), which handles the unportable details for us, mostly. We avoid some pain.
Diffstat (limited to 'video')
-rw-r--r--video/out/vo_image.c3
-rw-r--r--video/out/vo_x11.c2
2 files changed, 2 insertions, 3 deletions
diff --git a/video/out/vo_image.c b/video/out/vo_image.c
index a130048e54..ccb8fba830 100644
--- a/video/out/vo_image.c
+++ b/video/out/vo_image.c
@@ -29,6 +29,7 @@
#include "osdep/io.h"
#include "options/path.h"
#include "talloc.h"
+#include "common/common.h"
#include "common/msg.h"
#include "video/out/vo.h"
#include "video/csputils.h"
@@ -52,7 +53,7 @@ static bool checked_mkdir(struct vo *vo, const char *buf)
{
MP_INFO(vo, "Creating output directory '%s'...\n", buf);
if (mkdir(buf, 0755) < 0) {
- char *errstr = strerror(errno);
+ char *errstr = mp_strerror(errno);
if (errno == EEXIST) {
struct stat stat_p;
if (stat(buf, &stat_p ) == 0 && S_ISDIR(stat_p.st_mode))
diff --git a/video/out/vo_x11.c b/video/out/vo_x11.c
index 40adb33ac0..419467279f 100644
--- a/video/out/vo_x11.c
+++ b/video/out/vo_x11.c
@@ -180,8 +180,6 @@ static bool getMyXImage(struct priv *p, int foo)
IPC_CREAT | 0777);
if (p->Shminfo[foo].shmid < 0) {
XDestroyImage(p->myximage[foo]);
- MP_VERBOSE(vo, "%s\n", strerror(errno));
- //perror( strerror( errno ) );
MP_WARN(vo, "Shared memory error,disabling ( seg id error )\n");
goto shmemerror;
}