daemon() has to be called prior to file descriptor setups
(otherwise file descriptors could be closed mistakenly) Obtained from: KAME MFC after: 1 week
This commit is contained in:
parent
455e535da1
commit
145b960169
@ -228,11 +228,11 @@ main(argc, argv)
|
||||
fprintf(stderr, "fatal: inet_pton failed\n");
|
||||
exit(1);
|
||||
}
|
||||
sock_open();
|
||||
|
||||
if (!fflag)
|
||||
daemon(1, 0);
|
||||
|
||||
sock_open();
|
||||
|
||||
/* record the current PID */
|
||||
pid = getpid();
|
||||
if ((pidfp = fopen(pidfilename, "w")) == NULL) {
|
||||
|
Loading…
Reference in New Issue
Block a user