source: branches/samba-3.2.x/source/lib/signal.c@ 247

Last change on this file since 247 was 133, checked in by Paul Smedley, 18 years ago

Update trunk to 3.2.0pre3

File size: 3.9 KB
Line 
1/*
2 Unix SMB/CIFS implementation.
3 signal handling functions
4
5 Copyright (C) Andrew Tridgell 1998
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
19*/
20
21#include "includes.h"
22
23/****************************************************************************
24 Catch child exits and reap the child zombie status.
25****************************************************************************/
26
27static void sig_cld(int signum)
28{
29 while (sys_waitpid((pid_t)-1,(int *)NULL, WNOHANG) > 0)
30 ;
31
32 /*
33 * Turns out it's *really* important not to
34 * restore the signal handler here if we have real POSIX
35 * signal handling. If we do, then we get the signal re-delivered
36 * immediately - hey presto - instant loop ! JRA.
37 */
38
39#if !defined(HAVE_SIGACTION)
40 CatchSignal(SIGCLD, sig_cld);
41#endif
42}