mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-22 02:53:09 +00:00
don't unlock pidfile after write pid
This commit is contained in:
@@ -60,19 +60,13 @@ write_pid(const char *pidfile) {
|
||||
}
|
||||
fflush(f);
|
||||
|
||||
if (flock(fd, LOCK_UN) == -1) {
|
||||
fprintf(stderr, "Can't unlock pidfile %s.\n", pidfile);
|
||||
close(fd);
|
||||
return 0;
|
||||
}
|
||||
close(fd);
|
||||
|
||||
return pid;
|
||||
}
|
||||
|
||||
int
|
||||
daemon_init(const char *pidfile) {
|
||||
int pid = check_pid(pidfile);
|
||||
|
||||
if (pid) {
|
||||
fprintf(stderr, "Skynet is already running, pid = %d.\n", pid);
|
||||
return 1;
|
||||
@@ -93,5 +87,5 @@ daemon_init(const char *pidfile) {
|
||||
|
||||
int
|
||||
daemon_exit(const char *pidfile) {
|
||||
return unlink (pidfile);
|
||||
return unlink(pidfile);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user