diff options
author | wm4 <wm4@nowhere> | 2017-06-27 14:22:28 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2017-06-29 10:31:13 +0200 |
commit | cd25d98bfa38c87bd857264e876cd8be42eb3678 (patch) | |
tree | f721ae2930ac3ce823326592f986f4f4c20654e6 /input/ipc-unix.c | |
parent | 7eca787571aab982acaadee79abb0f40f9f14b6a (diff) | |
download | mpv-cd25d98bfa38c87bd857264e876cd8be42eb3678.tar.bz2 mpv-cd25d98bfa38c87bd857264e876cd8be42eb3678.tar.xz |
Avoid calling close(-1)
While this is perfectly OK on Unix, it causes annoying valgrind
warnings, and might be otherwise confusing to others.
On Windows, the runtime can actually abort the process if this is
called.
push.c part taken from a patch by Pedro Pombeiro.
Diffstat (limited to 'input/ipc-unix.c')
-rw-r--r-- | input/ipc-unix.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/input/ipc-unix.c b/input/ipc-unix.c index f26e0cadde..c3315d21b5 100644 --- a/input/ipc-unix.c +++ b/input/ipc-unix.c @@ -402,8 +402,10 @@ struct mp_ipc_ctx *mp_init_ipc(struct mp_client_api *client_api, return arg; out: - close(arg->death_pipe[0]); - close(arg->death_pipe[1]); + if (arg->death_pipe[0] >= 0) { + close(arg->death_pipe[0]); + close(arg->death_pipe[1]); + } talloc_free(arg); return NULL; } |