mirror of
https://github.com/troglobit/finit.git
synced 2026-10-02 05:52:48 +07:00
Follow-up to d82d1197: ensure PID file doesn't exist
Before we clear all conditions for a service, ensure pid_file_read() didn't fail due to the PID file not (yet) containing a valid number. If the process dies while starting up, and subsequently removes its PID file, then the file shouldn't exist. However, if we get inotify before the process has finished writing the PID, then we just return and wait for the next event. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
+4
-2
@@ -92,9 +92,11 @@ static void pidfile_update_conds(char *dir, char *name, uint32_t mask)
|
||||
if (svc_is_forking(svc)) {
|
||||
pid_t pid;
|
||||
|
||||
pid = pid_file_read(pid_file(svc));
|
||||
pid = pid_file_read(fn);
|
||||
if (pid == -1) {
|
||||
cond_clear(cond);
|
||||
/* handle case when service dies immediately */
|
||||
if (!fexist(fn))
|
||||
cond_clear(cond);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user