diff options
Diffstat (limited to 'src/core/pidwait.c')
-rw-r--r-- | src/core/pidwait.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/core/pidwait.c b/src/core/pidwait.c index 1c0ef775..82a11c6c 100644 --- a/src/core/pidwait.c +++ b/src/core/pidwait.c @@ -48,11 +48,13 @@ static int child_check(void) /* wait for each pid.. */ for (tmp = pids; tmp != NULL; tmp = next) { - next = tmp->next; - if (waitpid(GPOINTER_TO_INT(tmp->data), &status, WNOHANG) > 0) { + int pid = GPOINTER_TO_INT(tmp->data); + + next = tmp->next; + if (waitpid(pid, &status, WNOHANG) > 0) { /* process terminated, remove from list */ pids = g_slist_remove(pids, tmp->data); - signal_emit_id(signal_pidwait, 1, GPOINTER_TO_INT(tmp->data)); + signal_emit_id(signal_pidwait, 1, tmp->data); } } return 1; |