mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 04:52:59 +01:00
daemon-mode: add sleep() loop to prevent defunct child process, call setsid() in child
This commit is contained in:
parent
b7ebc662eb
commit
1c09a4adb2
8
init.cpp
8
init.cpp
@ -236,6 +236,10 @@ bool AppInit2(int argc, char* argv[])
|
||||
}
|
||||
if (pid > 0)
|
||||
return true;
|
||||
|
||||
pid_t sid = setsid();
|
||||
if (sid < 0)
|
||||
fprintf(stderr, "Error: setsid() returned %d errno %d\n", sid, errno);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -466,6 +470,10 @@ bool AppInit2(int argc, char* argv[])
|
||||
if (fFirstRun)
|
||||
SetStartOnSystemStartup(true);
|
||||
#endif
|
||||
|
||||
if (fDaemon)
|
||||
while (!fShutdown)
|
||||
Sleep(5000);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user