mirror of https://github.com/mirror/busybox.git
it should work even if you don't assign a pidfile
parent
ce91c8ac2b
commit
6caa073760
|
@ -59,15 +59,14 @@ void background(const char *pidfile)
|
||||||
#else /* __uClinux__ */
|
#else /* __uClinux__ */
|
||||||
int pid_fd;
|
int pid_fd;
|
||||||
|
|
||||||
if (!pidfile) return;
|
/* hold lock during fork. */
|
||||||
|
if (pidfile) pid_fd = pidfile_acquire(pidfile);
|
||||||
pid_fd = pidfile_acquire(pidfile); /* hold lock during fork. */
|
|
||||||
if (daemon(0, 0) == -1) {
|
if (daemon(0, 0) == -1) {
|
||||||
perror("fork");
|
perror("fork");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
daemonized++;
|
daemonized++;
|
||||||
pidfile_write_release(pid_fd);
|
if (pidfile) pidfile_write_release(pid_fd);
|
||||||
#endif /* __uClinux__ */
|
#endif /* __uClinux__ */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,8 +96,10 @@ void start_log_and_pid(const char *client_server, const char *pidfile)
|
||||||
sanitize_fds();
|
sanitize_fds();
|
||||||
|
|
||||||
/* do some other misc startup stuff while we are here to save bytes */
|
/* do some other misc startup stuff while we are here to save bytes */
|
||||||
|
if (pidfile) {
|
||||||
pid_fd = pidfile_acquire(pidfile);
|
pid_fd = pidfile_acquire(pidfile);
|
||||||
pidfile_write_release(pid_fd);
|
pidfile_write_release(pid_fd);
|
||||||
|
}
|
||||||
|
|
||||||
/* equivelent of doing a fflush after every \n */
|
/* equivelent of doing a fflush after every \n */
|
||||||
setlinebuf(stdout);
|
setlinebuf(stdout);
|
||||||
|
|
Loading…
Reference in New Issue