diff options
author | Nick Mathewson <nickm@torproject.org> | 2018-09-14 10:24:46 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-09-14 10:24:46 -0400 |
commit | 0e4fcd39966ac6f5273920a6a19a8527d891d78e (patch) | |
tree | 93b8e5aadd8b017fccc9b71131398471336c16ba /src/lib | |
parent | e43ae24e7d8cc96eaed41b8e135232248ac39721 (diff) | |
parent | 75d6609eb1b1503f28054479c92d4f9ad6fe617d (diff) | |
download | tor-0e4fcd39966ac6f5273920a6a19a8527d891d78e.tar.gz tor-0e4fcd39966ac6f5273920a6a19a8527d891d78e.zip |
Merge branch 'nss_27664'
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/process/daemon.c | 10 | ||||
-rw-r--r-- | src/lib/process/daemon.h | 4 |
2 files changed, 14 insertions, 0 deletions
diff --git a/src/lib/process/daemon.c b/src/lib/process/daemon.c index c64affd8b9..9fc31eb2e4 100644 --- a/src/lib/process/daemon.c +++ b/src/lib/process/daemon.c @@ -38,6 +38,16 @@ static int finish_daemon_called = 0; /** Socketpair used to communicate between parent and child process while * daemonizing. */ static int daemon_filedes[2]; + +/** + * Return true iff we've called start_daemon() at least once. + */ +bool +start_daemon_has_been_called(void) +{ + return start_daemon_called != 0; +} + /** Start putting the process into daemon mode: fork and drop all resources * except standard fds. The parent process never returns, but stays around * until finish_daemon is called. (Note: it's safe to call this more diff --git a/src/lib/process/daemon.h b/src/lib/process/daemon.h index c3b78029af..e33bd56701 100644 --- a/src/lib/process/daemon.h +++ b/src/lib/process/daemon.h @@ -11,7 +11,11 @@ #ifndef TOR_DAEMON_H #define TOR_DAEMON_H +#include <stdbool.h> + int start_daemon(void); int finish_daemon(const char *desired_cwd); +bool start_daemon_has_been_called(void); + #endif |