SIGCHLD SIG_IGN, then wait - warning messages

Hardy Merrill hmerrill at redhat.com
Tue Aug 5 00:53:36 EST 2003


This patch worked for me, and it worked for the person
that posted the bug.  No more warnings after applying
this patch.

I'm not sure what the procedure is for this, but I'd like
to request that this patch be committed so it will be
in future rsync versions.

Thanks Wayne!

-- 
Hardy Merrill
Red Hat, Inc.

Wayne Davison [wayned at samba.org] wrote:
> On Thu, Jul 24, 2003 at 09:09:48AM -0400, Hardy Merrill wrote:
> > What is the status on this?
> 
> I finally educated myself on this issue, and would like to propose a
> patch.  Since there are reports that zombies can get created when using
> SIG_IGN on FreeBSD as well as other unices, I think we should change the
> code to catch the signal and cleanup the zombies in the signal handler.
> This would make the code similar to the handling in main.c.
> 
> ..wayne..

> --- socket.c	27 Jan 2003 03:35:09 -0000	1.84
> +++ socket.c	24 Jul 2003 19:25:05 -0000
> @@ -374,6 +374,14 @@
>  }
>  
>  
> +static RETSIGTYPE sigchld_handler(int UNUSED(val)) {
> +	signal(SIGCHLD, sigchld_handler);
> +#ifdef WNOHANG
> +	while (waitpid(-1, NULL, WNOHANG) > 0) {}
> +#endif
> +}
> +
> +
>  void start_accept_loop(int port, int (*fn)(int, int))
>  {
>  	int s;
> @@ -419,14 +427,7 @@
>  
>  		if (fd == -1) continue;
>  
> -		signal(SIGCHLD, SIG_IGN);
> -
> -		/* we shouldn't have any children left hanging around
> -		   but I have had reports that on Digital Unix zombies
> -		   are produced, so this ensures that they are reaped */
> -#ifdef WNOHANG
> -                while (waitpid(-1, NULL, WNOHANG) > 0);
> -#endif
> +		signal(SIGCHLD, sigchld_handler);
>  
>  		if ((pid = fork()) == 0) {
>  			int ret;



More information about the rsync mailing list