From: Yu Watanabe Date: Tue, 25 Dec 2018 15:36:55 +0000 (+0900) Subject: udev-event: do not read stdout or stderr if the pipefd is not created X-Git-Tag: v241-rc1~142 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=adeb26c1affd09138bb96a9e25b795d146e64c97;p=thirdparty%2Fsystemd.git udev-event: do not read stdout or stderr if the pipefd is not created Fixes #11255. --- diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c index e28d6a5d08b..3e916976c03 100644 --- a/src/udev/udev-event.c +++ b/src/udev/udev-event.c @@ -570,13 +570,17 @@ static int spawn_wait(Spawn *spawn) { } } - r = sd_event_add_io(e, NULL, spawn->fd_stdout, EPOLLIN, on_spawn_io, spawn); - if (r < 0) - return r; + if (spawn->fd_stdout >= 0) { + r = sd_event_add_io(e, NULL, spawn->fd_stdout, EPOLLIN, on_spawn_io, spawn); + if (r < 0) + return r; + } - r = sd_event_add_io(e, NULL, spawn->fd_stderr, EPOLLIN, on_spawn_io, spawn); - if (r < 0) - return r; + if (spawn->fd_stderr >= 0) { + r = sd_event_add_io(e, NULL, spawn->fd_stderr, EPOLLIN, on_spawn_io, spawn); + if (r < 0) + return r; + } r = sd_event_add_child(e, NULL, spawn->pid, WEXITED, on_spawn_sigchld, spawn); if (r < 0)