diff options
author | wm4 <wm4@nowhere> | 2014-07-25 14:30:59 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-07-25 14:32:45 +0200 |
commit | ef600041ba1afb84b9caed44f43deb1000651340 (patch) | |
tree | 02be51a54b02c6fec3e0bcededf353fc950e465f /player/client.c | |
parent | 18c432b83a23181b81360d2f622bbb0c91fdb36d (diff) | |
download | mpv-ef600041ba1afb84b9caed44f43deb1000651340.tar.bz2 mpv-ef600041ba1afb84b9caed44f43deb1000651340.tar.xz |
audio, client API: check mp_make_wakeup_pipe() return value
Could fail e.g. due to FD exhaustion.
Diffstat (limited to 'player/client.c')
-rw-r--r-- | player/client.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/player/client.c b/player/client.c index e7a993dd0e..0a64dd855d 100644 --- a/player/client.c +++ b/player/client.c @@ -1331,11 +1331,12 @@ int mpv_get_wakeup_pipe(mpv_handle *ctx) { pthread_mutex_lock(&ctx->wakeup_lock); if (ctx->wakeup_pipe[0] == -1) { - mp_make_wakeup_pipe(ctx->wakeup_pipe); - write(ctx->wakeup_pipe[1], &(char){0}, 1); + if (mp_make_wakeup_pipe(ctx->wakeup_pipe) >= 0) + write(ctx->wakeup_pipe[1], &(char){0}, 1); } + int fd = ctx->wakeup_pipe[0]; pthread_mutex_unlock(&ctx->wakeup_lock); - return ctx->wakeup_pipe[0]; + return fd; } unsigned long mpv_client_api_version(void) |