mirror of
https://github.com/servalproject/serval-dna.git
synced 2024-12-19 13:17:56 +00:00
Minor code refactor
This commit is contained in:
parent
09f8434a21
commit
27f2d00d5e
@ -607,8 +607,9 @@ int app_server_start(int argc, const char *const *argv, struct command_line_opti
|
||||
if (foregroundP)
|
||||
return server(NULL);
|
||||
switch ((pid = fork())) {
|
||||
case 0: {
|
||||
// Child process.
|
||||
case -1:
|
||||
return WHYF("fork() failed: %s [errno=%d]", strerror(errno), errno);
|
||||
case 0: { // Child process.
|
||||
chdir("/");
|
||||
close(0);
|
||||
open("/dev/null", O_RDONLY);
|
||||
@ -625,9 +626,7 @@ int app_server_start(int argc, const char *const *argv, struct command_line_opti
|
||||
}
|
||||
return server(NULL);
|
||||
}
|
||||
case -1:
|
||||
return WHYF("fork() failed: %s [errno=%d]", strerror(errno), errno);
|
||||
default: {
|
||||
default: { // Parent process
|
||||
/* Allow a few seconds for the process to start, and keep an eye on things while this is
|
||||
happening. */
|
||||
time_t timeout = time(NULL) + 5;
|
||||
|
Loading…
Reference in New Issue
Block a user