--- lbbs/src/init.c 2025/05/02 03:32:19 1.14 +++ lbbs/src/init.c 2025/05/04 14:54:55 1.15 @@ -32,21 +32,34 @@ void init_daemon(void) { int pid; - int i; - if (pid = fork()) + pid = fork(); + + if (pid > 0) // Parent process + { exit(0); - else if (pid < 0) + } + else if (pid < 0) // Error + { exit(1); + } + // Child process setsid(); - if (pid = fork()) + pid = fork(); + + if (pid > 0) // Parent process + { exit(0); - else if (pid < 0) + } + else if (pid < 0) // Error + { exit(1); + } - umask(0); + // Child process + umask(022); return; }