Parent Directory
|
Revision Log
|
Patch
| Revision 1.14 by sysadm, Fri May 2 03:32:19 2025 UTC | Revision 1.15 by sysadm, Sun May 4 14:54:55 2025 UTC | |
|---|---|---|
| # | Line 32 | Line 32 |
| 32 | void init_daemon(void) | void init_daemon(void) |
| 33 | { | { |
| 34 | int pid; | int pid; |
| int i; | ||
| 35 | ||
| 36 | if (pid = fork()) | pid = fork(); |
| 37 | ||
| 38 | if (pid > 0) // Parent process | |
| 39 | { | |
| 40 | exit(0); | exit(0); |
| 41 | else if (pid < 0) | } |
| 42 | else if (pid < 0) // Error | |
| 43 | { | |
| 44 | exit(1); | exit(1); |
| 45 | } | |
| 46 | ||
| 47 | // Child process | |
| 48 | setsid(); | setsid(); |
| 49 | ||
| 50 | if (pid = fork()) | pid = fork(); |
| 51 | ||
| 52 | if (pid > 0) // Parent process | |
| 53 | { | |
| 54 | exit(0); | exit(0); |
| 55 | else if (pid < 0) | } |
| 56 | else if (pid < 0) // Error | |
| 57 | { | |
| 58 | exit(1); | exit(1); |
| 59 | } | |
| 60 | ||
| 61 | umask(0); | // Child process |
| 62 | umask(022); | |
| 63 | ||
| 64 | return; | return; |
| 65 | } | } |
|
||||||||
| webmaster@leafok.com | ViewVC Help |
| Powered by ViewVC 1.3.0-beta1 |