From 8276d615bafddaf010e9a6e2ccb6952f0075eb80 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 6 May 2026 12:47:44 +0200 Subject: [PATCH] filter-graph: handle fcntl errors better Don't set invalid flags when the F_GETFL failed. --- spa/plugins/filter-graph/plugin_builtin.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/spa/plugins/filter-graph/plugin_builtin.c b/spa/plugins/filter-graph/plugin_builtin.c index 1e4ae4e41..899212296 100644 --- a/spa/plugins/filter-graph/plugin_builtin.c +++ b/spa/plugins/filter-graph/plugin_builtin.c @@ -3114,8 +3114,11 @@ static void *pipe_instantiate(const struct spa_fga_plugin *plugin, const struct do_exec(impl, command); - fcntl(impl->write_fd, F_SETFL, fcntl(impl->write_fd, F_GETFL) | O_NONBLOCK); - fcntl(impl->read_fd, F_SETFL, fcntl(impl->read_fd, F_GETFL) | O_NONBLOCK); + int flags; + if ((flags = fcntl(impl->write_fd, F_GETFL)) >= 0) + fcntl(impl->write_fd, F_SETFL, flags | O_NONBLOCK); + if ((flags = fcntl(impl->read_fd, F_GETFL)) >= 0) + fcntl(impl->read_fd, F_SETFL, flags | O_NONBLOCK); return impl; }