1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-01 09:21:26 +03:00

udev-event: do not read stdout or stderr if the pipefd is not created

Fixes #11255.
This commit is contained in:
Yu Watanabe 2018-12-26 00:36:55 +09:00 committed by Lennart Poettering
parent a5c67ccc57
commit adeb26c1af

View File

@ -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)