mirror of
https://github.com/troglobit/finit.git
synced 2026-11-06 15:51:03 +00: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:
1 parent
04fd3f7a1b
commit
7e3465a022
1 file changed
+5
-1
@@ -248,6 +248,10 @@ void svc_monitor(void)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
_d("Ouch, lost pid %d - %s(%d)", lost, name, svc->pid);
|
_d("Ouch, lost pid %d - %s(%d)", lost, name, svc->pid);
|
||||||
|
|
||||||
|
/* No longer running, update books. */
|
||||||
|
svc->pid = 0;
|
||||||
|
|
||||||
if (sig_stopped()) {
|
if (sig_stopped()) {
|
||||||
_e("Stopped, not respawning killed processes.");
|
_e("Stopped, not respawning killed processes.");
|
||||||
break;
|
break;
|
||||||
@@ -337,7 +341,7 @@ int svc_start(svc_t *svc)
|
|||||||
char arg[MAX_ARG_LEN];
|
char arg[MAX_ARG_LEN];
|
||||||
|
|
||||||
snprintf(arg, sizeof(arg), "%s ", args[i]);
|
snprintf(arg, sizeof(arg), "%s ", args[i]);
|
||||||
if ((sizeof(buf) - strlen(buf)) < strlen(arg))
|
if (strlen(arg) < (sizeof(buf) - strlen(buf)))
|
||||||
strcat(buf, arg);
|
strcat(buf, arg);
|
||||||
}
|
}
|
||||||
_e("%starting %s: %s", respawn ? "Res" : "S", svc->cmd, buf);
|
_e("%starting %s: %s", respawn ? "Res" : "S", svc->cmd, buf);
|
||||||
|
|||||||
Reference in new issue
Block a user