From ef600041ba1afb84b9caed44f43deb1000651340 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 25 Jul 2014 14:30:59 +0200 Subject: audio, client API: check mp_make_wakeup_pipe() return value Could fail e.g. due to FD exhaustion. --- player/client.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'player') 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) -- cgit v1.2.3