]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Unix processes / IPC / Utilize pipes with "close-on-exec" flag set
authorexcurso <w.zimpel@dev.utilizer.de>
Mon, 4 Aug 2025 19:38:47 +0000 (19:38 +0000)
committerDavid Goulet <dgoulet@torproject.org>
Mon, 4 Aug 2025 19:38:47 +0000 (19:38 +0000)
src/lib/process/process_unix.c

index 7fec97939fa6643b12e4f9ab25e7184995b42c0e..f708eafb6869d41dd0fe069bb3f2fc266559476b 100644 (file)
@@ -49,6 +49,8 @@
 
 #ifndef _WIN32
 
+#include "lib/fdio/fdio.h"
+
 /** Internal state for Unix handles. */
 struct process_unix_handle_t {
   /** Unix File Descriptor. */
@@ -137,7 +139,7 @@ process_unix_exec(process_t *process)
   unix_process = process_get_unix_process(process);
 
   /* Create standard in pipe. */
-  retval = pipe(stdin_pipe);
+  retval = tor_pipe_cloexec(stdin_pipe);
 
   if (-1 == retval) {
     log_warn(LD_PROCESS,
@@ -149,7 +151,7 @@ process_unix_exec(process_t *process)
   }
 
   /* Create standard out pipe. */
-  retval = pipe(stdout_pipe);
+  retval = tor_pipe_cloexec(stdout_pipe);
 
   if (-1 == retval) {
     log_warn(LD_PROCESS,
@@ -165,7 +167,7 @@ process_unix_exec(process_t *process)
   }
 
   /* Create standard error pipe. */
-  retval = pipe(stderr_pipe);
+  retval = tor_pipe_cloexec(stderr_pipe);
 
   if (-1 == retval) {
     log_warn(LD_PROCESS,