mirror of
https://github.com/servalproject/serval-dna.git
synced 2024-12-23 15:02:27 +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)
|
if (foregroundP)
|
||||||
return server(NULL);
|
return server(NULL);
|
||||||
switch ((pid = fork())) {
|
switch ((pid = fork())) {
|
||||||
case 0: {
|
case -1:
|
||||||
// Child process.
|
return WHYF("fork() failed: %s [errno=%d]", strerror(errno), errno);
|
||||||
|
case 0: { // Child process.
|
||||||
chdir("/");
|
chdir("/");
|
||||||
close(0);
|
close(0);
|
||||||
open("/dev/null", O_RDONLY);
|
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);
|
return server(NULL);
|
||||||
}
|
}
|
||||||
case -1:
|
default: { // Parent process
|
||||||
return WHYF("fork() failed: %s [errno=%d]", strerror(errno), errno);
|
|
||||||
default: {
|
|
||||||
/* Allow a few seconds for the process to start, and keep an eye on things while this is
|
/* Allow a few seconds for the process to start, and keep an eye on things while this is
|
||||||
happening. */
|
happening. */
|
||||||
time_t timeout = time(NULL) + 5;
|
time_t timeout = time(NULL) + 5;
|
||||||
|
Loading…
Reference in New Issue
Block a user