]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
udev-event: do not read stdout or stderr if the pipefd is not created
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 25 Dec 2018 15:36:55 +0000 (00:36 +0900)
committerLennart Poettering <lennart@poettering.net>
Fri, 28 Dec 2018 11:51:40 +0000 (12:51 +0100)
Fixes #11255.

src/udev/udev-event.c

index e28d6a5d08b5a751d36dba6960974b72f783a9f2..3e916976c030bb0b792e616e6d6c270094dcebe5 100644 (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)