Remove pid file when exiting.

This commit is contained in:
Paul Lietar
2013-06-20 17:02:56 +10:00
committed by James Laird
parent c404660122
commit dbe13e399a
2 changed files with 10 additions and 0 deletions
+9
View File
@@ -77,3 +77,12 @@ void daemon_ready() {
close(daemon_pipe[1]);
}
void daemon_exit() {
if (lock_fd) {
lockf(lock_fd, F_ULOCK, 0);
close(lock_fd);
unlink(config.pidfile);
lock_fd = -1;
}
}
+1
View File
@@ -3,5 +3,6 @@
void daemon_init();
void daemon_ready();
void daemon_exit();
#endif // _DAEMON_H