~ttx/openldap/lucid-gssapi-495418

« back to all changes in this revision

Viewing changes to libraries/liblutil/signal.c

  • Committer: Bazaar Package Importer
  • Author(s): Mathias Gug
  • Date: 2008-07-10 14:45:49 UTC
  • Revision ID: james.westby@ubuntu.com-20080710144549-wck73med0e72gfyo
Tags: upstream-2.4.10
ImportĀ upstreamĀ versionĀ 2.4.10

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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/>.
 
3
 *
 
4
 * Copyright 1998-2008 The OpenLDAP Foundation.
 
5
 * All rights reserved.
 
6
 *
 
7
 * Redistribution and use in source and binary forms, with or without
 
8
 * modification, are permitted only as authorized by the OpenLDAP
 
9
 * Public License.
 
10
 *
 
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>.
 
14
 */
 
15
 
 
16
#include "portable.h"
 
17
 
 
18
#ifdef HAVE_SIGACTION
 
19
#include <ac/string.h>
 
20
#include <ac/signal.h>
 
21
 
 
22
lutil_sig_t
 
23
lutil_sigaction(int sig, lutil_sig_t func)
 
24
{
 
25
        struct sigaction action, oaction;
 
26
 
 
27
        memset( &action, '\0', sizeof(action) );
 
28
 
 
29
        action.sa_handler = func;
 
30
        sigemptyset( &action.sa_mask );
 
31
#ifdef SA_RESTART
 
32
        action.sa_flags |= SA_RESTART;
 
33
#endif
 
34
        
 
35
        if( sigaction( sig, &action, &oaction ) != 0 ) {
 
36
                return NULL;
 
37
        }
 
38
 
 
39
        return oaction.sa_handler;
 
40
}
 
41
#endif