diff options
author | Junio C Hamano <gitster@pobox.com> | 2012-09-14 21:39:37 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-09-14 21:39:37 -0700 |
commit | 5816cc7ca14c476ab34142eb05b817df9a7240cf (patch) | |
tree | 9225cc2886ae3cf3e81cf14206ed706f62d0830b /run-command.c | |
parent | cd14f3e17cf60c478ef4e921fc622b6164cb2f25 (diff) | |
parent | bdee397d7c2345d467548ef9446a2a63b72c5449 (diff) | |
download | git-5816cc7ca14c476ab34142eb05b817df9a7240cf.tar.gz |
Merge branch 'dg/run-command-child-cleanup'
The code to wait for subprocess and remove it from our internal queue
wasn't quite right.
* dg/run-command-child-cleanup:
run-command.c: fix broken list iteration in clear_child_for_cleanup
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 f9922b9ecc..1101ef7237 100644 --- a/run-command.c +++ b/run-command.c @@ -53,13 +53,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; } } |