1
/* $OpenLDAP: pkg/ldap/libraries/liblutil/signal.c,v 1.10.2.3 2008/02/11 23:26:42 kurt Exp $ */
2
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
4
* Copyright 1998-2008 The OpenLDAP Foundation.
7
* Redistribution and use in source and binary forms, with or without
8
* modification, are permitted only as authorized by the OpenLDAP
11
* A copy of this license is available in the file LICENSE in the
12
* top-level directory of the distribution or, alternatively, at
13
* <http://www.OpenLDAP.org/license.html>.
19
#include <ac/string.h>
20
#include <ac/signal.h>
23
lutil_sigaction(int sig, lutil_sig_t func)
25
struct sigaction action, oaction;
27
memset( &action, '\0', sizeof(action) );
29
action.sa_handler = func;
30
sigemptyset( &action.sa_mask );
32
action.sa_flags |= SA_RESTART;
35
if( sigaction( sig, &action, &oaction ) != 0 ) {
39
return oaction.sa_handler;