]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
execute: invalidate idle pipe after use
authorLennart Poettering <lennart@poettering.net>
Fri, 11 Sep 2015 16:14:11 +0000 (18:14 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 11 Sep 2015 16:31:49 +0000 (18:31 +0200)
Not strictly necessary, but makes clear the fds are invalidated. Make
sure we do the same here as in most other cases.

src/core/execute.c

index d1acda6682e24af3c14e6ee9ddb1a852e0a0a6c4..8773d9cdfbc4f65bca466c1143c41b7d7cecf2d0 100644 (file)
@@ -1160,8 +1160,8 @@ static void do_idle_pipe_dance(int idle_pipe[4]) {
         assert(idle_pipe);
 
 
-        safe_close(idle_pipe[1]);
-        safe_close(idle_pipe[2]);
+        idle_pipe[1] = safe_close(idle_pipe[1]);
+        idle_pipe[2] = safe_close(idle_pipe[2]);
 
         if (idle_pipe[0] >= 0) {
                 int r;
@@ -1176,11 +1176,11 @@ static void do_idle_pipe_dance(int idle_pipe[4]) {
                                 fd_wait_for_event(idle_pipe[0], POLLHUP, IDLE_TIMEOUT2_USEC);
                 }
 
-                safe_close(idle_pipe[0]);
+                idle_pipe[0] = safe_close(idle_pipe[0]);
 
         }
 
-        safe_close(idle_pipe[3]);
+        idle_pipe[3] = safe_close(idle_pipe[3]);
 }
 
 static int build_environment(