]> mj.ucw.cz Git - libucw.git/commitdiff
Daemon: Returned original check of written pidfile after start, but don't fail on...
authorPavel Charvat <pchar@ucw.cz>
Thu, 9 Oct 2014 10:13:27 +0000 (10:13 +0000)
committerPavel Charvat <pchar@ucw.cz>
Thu, 9 Oct 2014 10:13:27 +0000 (10:13 +0000)
ucw/daemon-ctrl.c

index a7a196c0c8a7bc2cea5bcaf734a5420a1848f533..baaf9725c4d822130efe466cfb0cb1f12aec6612 100644 (file)
@@ -165,7 +165,10 @@ daemon_control(struct daemon_control_params *dc)
              st = daemon_control_err(dc, "Daemon %s %s", dc->argv[0], ecmsg);
              goto done;
            }
-         if (st != DAEMON_STATUS_STALE)
+         enum daemon_control_status st2 = daemon_read_pid(dc, 0, &pid);
+         if (st2 != DAEMON_STATUS_OK && st2 != DAEMON_STATUS_NOT_RUNNING)
+           st = daemon_control_err(dc, "Daemon %s failed to write the PID file `%s'", dc->argv[0], dc->pid_file);
+         else if (st != DAEMON_STATUS_STALE)
            st = DAEMON_STATUS_OK;
        }
       break;