Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-6]: src/usr.bin/mail Pull up revision 1.15 (requested by perry ...



details:   https://anonhg.NetBSD.org/src/rev/0416d4948b3a
branches:  netbsd-1-6
changeset: 530260:0416d4948b3a
user:      tron <tron%NetBSD.org@localhost>
date:      Sun Jun 15 12:52:40 2003 +0000

description:
Pull up revision 1.15 (requested by perry in ticket #1236):
Fix a bug introduced by Christos Zoulas in version 1.4.
He accidently moved the call to block the SIGCHLD to the wrong side of
the call to findchild().
Caused a coredump in one in every N thousand invocations of mail,
which I have been hunting for literally years.
Fixes PR 19696 from Mason Loring Bliss, too.
By the way, this is a prime example of why declarations of the form
struct foo *p = funcall();
are pure liquid evil.

diffstat:

 usr.bin/mail/popen.c |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (46 lines):

diff -r 7b9809297fe5 -r 0416d4948b3a usr.bin/mail/popen.c
--- a/usr.bin/mail/popen.c      Sun Jun 15 12:49:31 2003 +0000
+++ b/usr.bin/mail/popen.c      Sun Jun 15 12:52:40 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: popen.c,v 1.14 2002/03/05 21:29:30 wiz Exp $   */
+/*     $NetBSD: popen.c,v 1.14.2.1 2003/06/15 12:52:40 tron Exp $      */
 
 /*
  * Copyright (c) 1980, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)popen.c    8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: popen.c,v 1.14 2002/03/05 21:29:30 wiz Exp $");
+__RCSID("$NetBSD: popen.c,v 1.14.2.1 2003/06/15 12:52:40 tron Exp $");
 #endif
 #endif /* not lint */
 
@@ -337,11 +337,12 @@
 wait_child(int pid)
 {
        sigset_t nset, oset;
-       struct child *cp = findchild(pid);
+       struct child *cp;
        sigemptyset(&nset);
        sigaddset(&nset, SIGCHLD);
        sigprocmask(SIG_BLOCK, &nset, &oset);
 
+       cp = findchild(pid);
        while (!cp->done)
                sigsuspend(&oset);
        wait_status = cp->status;
@@ -357,11 +358,12 @@
 free_child(int pid)
 {
        sigset_t nset, oset;
-       struct child *cp = findchild(pid);
+       struct child *cp;
        sigemptyset(&nset);
        sigaddset(&nset, SIGCHLD);
        sigprocmask(SIG_BLOCK, &nset, &oset);
 
+       cp = findchild(pid);
        if (cp->done)
                delchild(cp);
        else



Home | Main Index | Thread Index | Old Index