]> git.sur5r.net Git - openldap/blob - libraries/liblutil/signal.c
Update copyright statements
[openldap] / libraries / liblutil / signal.c
1 /* $OpenLDAP$ */
2 /*
3  * Copyright 2000-2002 The OpenLDAP Foundation
4  * COPYING RESTRICTIONS APPLY.  See COPYRIGHT File in top level directory
5  * of this package for details.
6  */
7
8 #include "portable.h"
9
10 #ifdef HAVE_SIGACTION
11 #include <ac/string.h>
12 #include <ac/signal.h>
13
14 lutil_sig_t
15 lutil_sigaction(int sig, lutil_sig_t func)
16 {
17         struct sigaction action, oaction;
18
19         memset( &action, '\0', sizeof(action) );
20
21         action.sa_handler = func;
22         sigemptyset( &action.sa_mask );
23 #ifdef SA_RESTART
24         action.sa_flags |= SA_RESTART;
25 #endif
26         
27         if( sigaction( sig, &action, &oaction ) != 0 ) {
28                 return NULL;
29         }
30
31         return oaction.sa_handler;
32 }
33 #endif