mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Fixed PID forgetfulness.
This commit is contained in:
parent
a13e30e8bb
commit
04580cf122
|
@ -398,11 +398,14 @@ int main(int argc, char *argv[])
|
||||||
pid_t pid = fork();
|
pid_t pid = fork();
|
||||||
|
|
||||||
if (pid < 0) {
|
if (pid < 0) {
|
||||||
|
fclose(pidf);
|
||||||
syslog(LOG_ERR, "Forking failed. Exiting.\n");
|
syslog(LOG_ERR, "Forking failed. Exiting.\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pid > 0) {
|
if (pid > 0) {
|
||||||
|
fprintf(pidf, "%d\n", pid);
|
||||||
|
fclose(pidf);
|
||||||
syslog(LOG_DEBUG, "Forked successfully: PID: %d.\n", pid);
|
syslog(LOG_DEBUG, "Forked successfully: PID: %d.\n", pid);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -410,9 +413,6 @@ int main(int argc, char *argv[])
|
||||||
// Change the file mode mask
|
// Change the file mode mask
|
||||||
umask(0);
|
umask(0);
|
||||||
|
|
||||||
fprintf(pidf, "%d\n", pid);
|
|
||||||
fclose(pidf);
|
|
||||||
|
|
||||||
// Create a new SID for the child process
|
// Create a new SID for the child process
|
||||||
if (setsid() < 0) {
|
if (setsid() < 0) {
|
||||||
syslog(LOG_ERR, "SID creation failure. Exiting.\n");
|
syslog(LOG_ERR, "SID creation failure. Exiting.\n");
|
||||||
|
|
Loading…
Reference in New Issue
Block a user