diff options
Diffstat (limited to 'run-command.c')
-rw-r--r-- | run-command.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/run-command.c b/run-command.c index 0204aaf7e8..d1d58d3e21 100644 --- a/run-command.c +++ b/run-command.c @@ -49,13 +49,14 @@ static void mark_child_for_cleanup(pid_t pid) static void clear_child_for_cleanup(pid_t pid) { - struct child_to_clean **last, *p; + struct child_to_clean **pp; - last = &children_to_clean; - for (p = children_to_clean; p; p = p->next) { - if (p->pid == pid) { - *last = p->next; - free(p); + for (pp = &children_to_clean; *pp; pp = &(*pp)->next) { + struct child_to_clean *clean_me = *pp; + + if (clean_me->pid == pid) { + *pp = clean_me->next; + free(clean_me); return; } } |