summaryrefslogtreecommitdiff
path: root/src/irmd/main.c
diff options
context:
space:
mode:
authordimitri staessens <[email protected]>2016-08-23 13:23:41 +0200
committerdimitri staessens <[email protected]>2016-08-23 13:26:20 +0200
commitc266a1e8609eb84e05acbd63b230777a4aa35977 (patch)
treeeb5cf7a9fea4e1ec752410640c6ae6fceef27b5f /src/irmd/main.c
parent1b57e9ab5e26f7fbd2a5f1eb9c920ff4c93fad56 (diff)
downloadouroboros-c266a1e8609eb84e05acbd63b230777a4aa35977.tar.gz
ouroboros-c266a1e8609eb84e05acbd63b230777a4aa35977.zip
irmd: Fix reaping child processes
Diffstat (limited to 'src/irmd/main.c')
-rw-r--r--src/irmd/main.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/irmd/main.c b/src/irmd/main.c
index c33ba3e6..5366b535 100644
--- a/src/irmd/main.c
+++ b/src/irmd/main.c
@@ -1286,15 +1286,16 @@ static pid_t auto_execute(char ** argv)
return -1;
}
- LOG_INFO("Executing %s.", argv[0]);
api = fork();
if (api == -1) {
LOG_ERR("Failed to fork");
return api;
}
- if (api != 0)
+ if (api != 0) {
+ LOG_INFO("Instantiated %s as AP-i %d.", argv[0], api);
return api;
+ }
execv(argv[0], argv);
@@ -1653,9 +1654,9 @@ void * irm_sanitize()
list_for_each_safe(p, h, &irmd->spawned_apis) {
struct pid_el * e = list_entry(p, struct pid_el, next);
+ waitpid(e->pid, &s, WNOHANG);
if (kill(e->pid, 0) >= 0)
continue;
- waitpid(e->pid, &s, WNOHANG);
LOG_DBG("Child process %d died, error %d.", e->pid, s);
list_del(&e->next);
free(e);