Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Aug 2000 11:28:47 -0700
From:      "'Alfred Perlstein'" <bright@wintelcom.net>
To:        Ben Smithurst <ben@FreeBSD.org>
Cc:        "Yevmenkin, Maksim N, CSCIO" <myevmenkin@att.com>, core-ix@hushmail.com, freebsd-hackers@FreeBSD.org
Subject:   Re: Preventing zombies to occure
Message-ID:  <20000825112847.Z1209@fw.wintelcom.net>
In-Reply-To: <20000825175439.C30144@strontium.scientia.demon.co.uk>; from ben@FreeBSD.org on Fri, Aug 25, 2000 at 05:54:39PM %2B0100
References:  <E598F159668DD311B9C700902799EAF44734E5@njb140po01.ems.att.com> <20000825062409.O1209@fw.wintelcom.net> <20000825175439.C30144@strontium.scientia.demon.co.uk>

next in thread | previous in thread | raw e-mail | index | archive | help
* Ben Smithurst <ben@FreeBSD.org> [000825 10:15] wrote:
> 'Alfred Perlstein' wrote:
> 
> > int
> > sigchld_handler(int) 
> > {
> > 
> > 	while (waitpid(-1, NULL, 0) || errno == EINTR)
> > 		;
> > }
> 
> Even more paranoid would be
> 
> int
> sigchld_handler(int)
> {
> 	int e = errno;
> 
> 	while (waitpid(-1, NULL, 0) || errno == EINTR)
> 		;
> 
> 	errno = e;
> }
> 
> otherwise you could get bogus errors reported, I think.
> 
> 	if ((fp = fopen(foo, "r")) == NULL)
> 		/* SIGCHLD arrives here */
> 		warn("can't open foo");

The code I presented is flawed as a result of an allnighter dealing
with postresql.  I'll enjoy thinking about this over the weekend. :)

-Alfred


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000825112847.Z1209>