From cd25d98bfa38c87bd857264e876cd8be42eb3678 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 27 Jun 2017 14:22:28 +0200 Subject: 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. --- audio/out/push.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'audio') diff --git a/audio/out/push.c b/audio/out/push.c index c271fc0cdc..c4083923fd 100644 --- a/audio/out/push.c +++ b/audio/out/push.c @@ -423,8 +423,11 @@ static void destroy_no_thread(struct ao *ao) ao->driver->uninit(ao); - for (int n = 0; n < 2; n++) - close(p->wakeup_pipe[n]); + for (int n = 0; n < 2; n++) { + int h = p->wakeup_pipe[n]; + if (h >= 0) + close(h); + } pthread_cond_destroy(&p->wakeup); pthread_mutex_destroy(&p->lock); -- cgit v1.2.3