aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2018-12-26 00:36:55 +0900
committerLennart Poettering <lennart@poettering.net>2018-12-28 12:51:40 +0100
commitadeb26c1affd09138bb96a9e25b795d146e64c97 (patch)
tree1f700fbb908c23775176b73d041942796b9d3189
parentswitch-root: fix error message (diff)
downloadsystemd-adeb26c1affd09138bb96a9e25b795d146e64c97.tar.gz
systemd-adeb26c1affd09138bb96a9e25b795d146e64c97.tar.bz2
systemd-adeb26c1affd09138bb96a9e25b795d146e64c97.zip
udev-event: do not read stdout or stderr if the pipefd is not createdHEADmaster
Fixes #11255.
-rw-r--r--src/udev/udev-event.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c
index e28d6a5d0..3e916976c 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)