Gero Treuner <[EMAIL PROTECTED]> wrote:
>
> --- mutt-stable/signal.c      Thu Apr 22 14:54:50 1999
> +++ mutt/signal.c     Wed Jun 16 17:29:41 1999
> @@ -82,9 +82,9 @@
>    if (i >= PidListLen)
>    {
>      /* quite a few children around... */
> -    safe_realloc ((void **) &PidList, (PidListLen += 2) * sizeof (pid_t));
> +    safe_realloc ((void **) &PidList, (PidListLen + 2) * sizeof (pid_t));
>      PidList[i++] = pid;
> -    for (; i < PidListLen; i++)
> +    for (; i < (PidListLen += 2); i++)
>        PidList[i] = 0;
>    }
>  }

Does this really fix the race condition?  It appeared to me that the
problem reported was that the child process exited and signaled us while
we were trying to allocate the new PidList.  Changing PidListLen later
on does keep us from accessing memory that doesn't exist, but it doesn't
stop the problem of a child terminating before we are ready to
acknowledge it.  Instead, that child-pid will simply not be found in the
list, and we'll go on to insert it after it's too late to reap.

Seems like the right thing to do is to block the SIGCHLD signal while
the PidList is being modified.

-- 
David DeSimone   | "The doctrine of human equality reposes on this:
[EMAIL PROTECTED]   |  that there is no man really clever who has not
Hewlett-Packard  |  found that he is stupid." -- Gilbert K. Chesterson
Convex Division  |    PGP: 5B 47 34 9F 3B 9A B0 0D  AB A6 15 F1 BB BE 8C 44

Reply via email to