The parent process now correctly returns the value from the child process.
This commit is contained in:
Markus Makela
2015-08-27 14:22:58 +03:00
parent 70a7a5f2f6
commit 0c552bab29
3 changed files with 60 additions and 4 deletions

View File

@ -141,7 +141,7 @@ setipaddress(struct in_addr *a, char *p) {
* Daemonize the process by forking and putting the process into the
* background.
*/
void gw_daemonize(void) {
bool gw_daemonize(void) {
pid_t pid;
pid = fork();
@ -153,13 +153,14 @@ void gw_daemonize(void) {
if (pid != 0) {
/* exit from main */
exit(0);
return true;
}
if (setsid() < 0) {
fprintf(stderr, "setsid() error %s\n", strerror(errno));
exit(1);
}
return false;
}
/**