remove unneeded fork(for now)
This commit is contained in:
parent
d9858da0d4
commit
955aeb64b7
17
yasnd.c
17
yasnd.c
@ -334,29 +334,12 @@ int main(void) {
|
|||||||
/* Our process ID and Session ID */
|
/* Our process ID and Session ID */
|
||||||
pid_t pid, sid;
|
pid_t pid, sid;
|
||||||
|
|
||||||
/* Fork off the parent process */
|
|
||||||
pid = fork();
|
|
||||||
if (pid < 0) {
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
/* If we got a good PID, then we can exit the parent process. */
|
|
||||||
if (pid > 0) {
|
|
||||||
exit(EXIT_SUCCESS);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Change the file mode mask */
|
/* Change the file mode mask */
|
||||||
umask(0);
|
umask(0);
|
||||||
|
|
||||||
/* Open any logs here */
|
/* Open any logs here */
|
||||||
openlog("yasnd", LOG_PID|LOG_CONS, LOG_USER);
|
openlog("yasnd", LOG_PID|LOG_CONS, LOG_USER);
|
||||||
|
|
||||||
/* Create a new SID for the child process */
|
|
||||||
sid = setsid();
|
|
||||||
if (sid < 0) {
|
|
||||||
/* Log the failure */
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Change the current working directory */
|
/* Change the current working directory */
|
||||||
if ((chdir("/")) < 0) {
|
if ((chdir("/")) < 0) {
|
||||||
/* Log the failure */
|
/* Log the failure */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user