From 84c01bb0bced24aa6f4a3b13e9d7965183c200ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= Date: Thu, 16 Jun 2022 17:54:18 +0200 Subject: [PATCH] pipewire: module-pipe-tunnel: accept file descriptor 0 As Coverity points out, `open()` returning 0 is not an error, it should be handled just like any other valid file descriptor. --- src/modules/module-pipe-tunnel.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/module-pipe-tunnel.c b/src/modules/module-pipe-tunnel.c index 02d8d1b55..8210d0885 100644 --- a/src/modules/module-pipe-tunnel.c +++ b/src/modules/module-pipe-tunnel.c @@ -377,7 +377,7 @@ static int create_fifo(struct impl *impl) do_unlink_fifo = true; } - if ((fd = open(filename, O_RDWR | O_CLOEXEC | O_NONBLOCK, 0)) <= 0) { + if ((fd = open(filename, O_RDWR | O_CLOEXEC | O_NONBLOCK, 0)) < 0) { res = -errno; pw_log_error("open('%s'): %s", filename, spa_strerror(res)); goto error; @@ -408,7 +408,7 @@ static int create_fifo(struct impl *impl) error: if (do_unlink_fifo) unlink(filename); - if (fd > 0) + if (fd >= 0) close(fd); return res; } @@ -453,7 +453,7 @@ static void impl_destroy(struct impl *impl) unlink(impl->filename); free(impl->filename); } - if (impl->fd > 0) + if (impl->fd >= 0) close(impl->fd); pw_properties_free(impl->stream_props);