Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
David Goulet
Tor
Commits
622a2c6b
Commit
622a2c6b
authored
Aug 08, 2018
by
Nick Mathewson
⛰
Browse files
Make finish_daemon() return a boolean to say whether it did anything.
parent
4f300d54
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/lib/process/daemon.c
View file @
622a2c6b
...
...
@@ -102,15 +102,16 @@ start_daemon(void)
/** Finish putting the process into daemon mode: drop standard fds, and tell
* the parent process to exit. (Note: it's safe to call this more than once:
* calls after the first are ignored. Calls start_daemon first if it hasn't
* been called already.)
* been called already.) Return true if we actually did a fork; false if we
* didn't.
*/
void
int
finish_daemon
(
const
char
*
desired_cwd
)
{
int
nullfd
;
char
c
=
'.'
;
if
(
finish_daemon_called
)
return
;
return
0
;
if
(
!
start_daemon_called
)
start_daemon
();
finish_daemon_called
=
1
;
...
...
@@ -149,6 +150,8 @@ finish_daemon(const char *desired_cwd)
log_err
(
LD_GENERAL
,
"write failed. Exiting."
);
}
close
(
daemon_filedes
[
1
]);
return
0
;
}
#else
/* !(!defined(_WIN32)) */
/* defined(_WIN32) */
...
...
src/lib/process/daemon.h
View file @
622a2c6b
...
...
@@ -12,6 +12,6 @@
#define TOR_DAEMON_H
void
start_daemon
(
void
);
void
finish_daemon
(
const
char
*
desired_cwd
);
int
finish_daemon
(
const
char
*
desired_cwd
);
#endif
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment