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

next in thread | previous in thread | raw e-mail | index | archive | help
'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");

-- 
Ben Smithurst / ben@FreeBSD.org / PGP: 0x99392F7D


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?20000825175439.C30144>