|
Lines 1625-1639
main(int ac, char **av)
Link Here
|
| 1625 |
* is setup and the listen sockets are bound |
1625 |
* is setup and the listen sockets are bound |
| 1626 |
*/ |
1626 |
*/ |
| 1627 |
if (!debug_flag) { |
1627 |
if (!debug_flag) { |
| 1628 |
FILE *f = fopen(options.pid_file, "w"); |
1628 |
FILE *f; |
|
|
1629 |
mode_t old_mask = umask(0022); |
| 1629 |
|
1630 |
|
| 1630 |
if (f == NULL) { |
1631 |
if ((f = fopen(options.pid_file, "w")) == NULL) { |
| 1631 |
error("Couldn't create pid file \"%s\": %s", |
1632 |
error("Couldn't create pid file \"%s\": %s", |
| 1632 |
options.pid_file, strerror(errno)); |
1633 |
options.pid_file, strerror(errno)); |
| 1633 |
} else { |
1634 |
} else { |
| 1634 |
fprintf(f, "%ld\n", (long) getpid()); |
1635 |
fprintf(f, "%ld\n", (long) getpid()); |
| 1635 |
fclose(f); |
1636 |
fclose(f); |
| 1636 |
} |
1637 |
} |
|
|
1638 |
umask(old_mask); |
| 1637 |
} |
1639 |
} |
| 1638 |
|
1640 |
|
| 1639 |
/* Accept a connection and return in a forked child */ |
1641 |
/* Accept a connection and return in a forked child */ |