From: Jim Newsome Date: Mon, 2 Jun 2025 22:10:45 +0000 (-0500) Subject: start_daemon: open pipe with cloexec X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4b8729fb47a8715d5d7041924759e73fa0844586;p=thirdparty%2Ftor.git start_daemon: open pipe with cloexec Fixes #41013 Fixes #41088 --- diff --git a/changes/bug41088 b/changes/bug41088 new file mode 100644 index 0000000000..7f9c178f97 --- /dev/null +++ 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 index ce1b6ecf59..0254cc6027 100644 --- 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 index abd1d36576..1bfb162d85 100644 --- 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.