mirror of
https://github.com/troglobit/finit.git
synced 2026-10-08 08:24:43 +07:00
Clear recorded PID of lost service.
Many callbacks check their svc->pid to determine SVC_RELOAD or SVC_START, they rely on it to be updated. When a service is lost we must therefore clear its recorded PID before asking the callback what to do. Also, swap comparison in debug code for dumping service arguments ... Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
@@ -248,6 +248,10 @@ void svc_monitor(void)
|
||||
continue;
|
||||
|
||||
_d("Ouch, lost pid %d - %s(%d)", lost, name, svc->pid);
|
||||
|
||||
/* No longer running, update books. */
|
||||
svc->pid = 0;
|
||||
|
||||
if (sig_stopped()) {
|
||||
_e("Stopped, not respawning killed processes.");
|
||||
break;
|
||||
@@ -337,7 +341,7 @@ int svc_start(svc_t *svc)
|
||||
char arg[MAX_ARG_LEN];
|
||||
|
||||
snprintf(arg, sizeof(arg), "%s ", args[i]);
|
||||
if ((sizeof(buf) - strlen(buf)) < strlen(arg))
|
||||
if (strlen(arg) < (sizeof(buf) - strlen(buf)))
|
||||
strcat(buf, arg);
|
||||
}
|
||||
_e("%starting %s: %s", respawn ? "Res" : "S", svc->cmd, buf);
|
||||
|
||||
Reference in New Issue
Block a user