commit d2b5942e2820bd1d386e3c1e77a92363b05d28df
parent ed28f2a1b3b1d40027a8b8d8b8a3a5d112ae3829
Author: Jim Newsome <jnewsome@torproject.org>
Date: Mon, 2 Jun 2025 17:10:45 -0500
start_daemon: open pipe with cloexec
Fixes #41013
Fixes #41088
Diffstat:
3 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/changes/bug41088 b/changes/bug41088
@@ -0,0 +1,4 @@
+ o Minor bugfixes (bridges, pluggable transport):
+ - Fix a bug causing the initial tor process to hang intead of exiting with
+ RunAsDaemon, when pluggable transports are used.
+ Fixes bug 41088; bugfix on 0.4.9.1-alpha.
diff --git a/src/lib/process/.may_include b/src/lib/process/.may_include
@@ -6,6 +6,7 @@ lib/container/*.h
lib/ctime/*.h
lib/err/*.h
lib/evloop/*.h
+lib/fdio/*.h
lib/fs/*.h
lib/intmath/*.h
lib/log/*.h
diff --git a/src/lib/process/daemon.c b/src/lib/process/daemon.c
@@ -13,6 +13,7 @@
#ifndef _WIN32
+#include "lib/fdio/fdio.h"
#include "lib/fs/files.h"
#include "lib/log/log.h"
#include "lib/thread/threads.h"
@@ -63,7 +64,7 @@ start_daemon(void)
return 0;
start_daemon_called = 1;
- if (pipe(daemon_filedes)) {
+ if (tor_pipe_cloexec(daemon_filedes)) {
/* LCOV_EXCL_START */
log_err(LD_GENERAL,"pipe failed; exiting. Error was %s", strerror(errno));
exit(1); // exit ok: during daemonize, pipe failed.