source: TI05-delivery/trunk/src/bbftp-server-3.2.0/bbftpd/set_father_signals.c @ 1328

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI05-delivery/trunk/src/bbftp-server-3.2.0/bbftpd/set_father_signals.c@1328
Revision 1328, 3.6 KB checked in by spascoe, 13 years ago (diff)

I've created a bbftpd log facility to replace syslog.
At present it allows you to log messages to a file in addition
to syslog. This should help testing on other machines.

Line 
1/*
2 * bbftpd/set_father_signals.c
3 * Copyright (C) 1999, 2000, 2001, 2002 IN2P3, CNRS
4 * bbftp@in2p3.fr
5 * http://doc.in2p3.fr/bbftp
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or 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, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
20 */ 
21
22/****************************************************************************
23
24 
25 
26 set_father_signals.c v 0.0.0  1999/11/24
27                      v 1.9.4  2000/10/16   - Supress %m
28                      v 2.0.1  2001/04/23   - Correct indentation
29 
30*****************************************************************************/
31#include <errno.h>
32#include <signal.h>
33#include <bbftpd_log.h>
34
35int set_father_signals() {
36    struct    sigaction    sga ;
37
38    sga.sa_handler= SIG_IGN ;
39    sigemptyset(&(sga.sa_mask));
40    sga.sa_flags = 0   ;
41    if ( sigaction(SIGABRT,&sga,0) < 0 ) {
42        bbftpd_log(BBFTPD_ERR,"Error sigaction SIGABRT : %s",strerror(errno)) ;
43        return(-1) ;
44    }
45    if ( sigaction(SIGALRM,&sga,0) < 0 ) {
46        bbftpd_log(BBFTPD_ERR,"Error sigaction SIGALRM : %s",strerror(errno)) ;
47        return(-1) ;
48    }
49    if ( sigaction(SIGHUP,&sga,0) < 0 ) {
50        bbftpd_log(BBFTPD_ERR,"Error sigaction SIGHUP : %s",strerror(errno)) ;
51        return(-1) ;
52    }
53    if ( sigaction(SIGINT,&sga,0) < 0 ) {
54        bbftpd_log(BBFTPD_ERR,"Error sigaction SIGINT : %s",strerror(errno)) ;
55        return(-1) ;
56    }
57    if ( sigaction(SIGPIPE,&sga,0) < 0 ) {
58        bbftpd_log(BBFTPD_ERR,"Error sigaction SIGPIPE : %s",strerror(errno)) ;
59        return(-1) ;
60    }
61    if ( sigaction(SIGQUIT,&sga,0) < 0 ) {
62        bbftpd_log(BBFTPD_ERR,"Error sigaction SIGQUIT : %s",strerror(errno)) ;
63        return(-1) ;
64    }
65    if ( sigaction(SIGTERM,&sga,0) < 0 ) {
66        bbftpd_log(BBFTPD_ERR,"Error sigaction SIGTERM : %s",strerror(errno)) ;
67        return(-1) ;
68    }
69    if ( sigaction(SIGUSR1,&sga,0) < 0 ) {
70        bbftpd_log(BBFTPD_ERR,"Error sigaction SIGUSR1 : %s",strerror(errno)) ;
71        return(-1) ;
72    }
73    if ( sigaction(SIGUSR2,&sga,0) < 0 ) {
74        bbftpd_log(BBFTPD_ERR,"Error sigaction SIGUSR2 : %s",strerror(errno)) ;
75        return(-1) ;
76    }
77    if ( sigaction(SIGCHLD,&sga,0) < 0 ) {
78        bbftpd_log(BBFTPD_ERR,"Error sigaction SIGCHLD : %s",strerror(errno)) ;
79        return(-1) ;
80    }
81    if ( sigaction(SIGTSTP,&sga,0) < 0 ) {
82        bbftpd_log(BBFTPD_ERR,"Error sigaction SIGTSTP : %s",strerror(errno)) ;
83        return(-1) ;
84    }
85    if ( sigaction(SIGPOLL,&sga,0) < 0 ) {
86        bbftpd_log(BBFTPD_ERR,"Error sigaction SIGPOLL : %s",strerror(errno)) ;
87        return(-1) ;
88    }
89    if ( sigaction(SIGPROF,&sga,0) < 0 ) {
90        bbftpd_log(BBFTPD_ERR,"Error sigaction SIGPROF : %s",strerror(errno)) ;
91        return(-1) ;
92    }
93    if ( sigaction(SIGURG,&sga,0) < 0 ) {
94        bbftpd_log(BBFTPD_ERR,"Error sigaction SIGURG : %s",strerror(errno)) ;
95        return(-1) ;
96    }
97    if ( sigaction(SIGVTALRM,&sga,0) < 0 ) {
98        bbftpd_log(BBFTPD_ERR,"Error sigaction SIGVTALRM : %s",strerror(errno)) ;
99        return(-1) ;
100    }
101    return 0 ;
102}
Note: See TracBrowser for help on using the repository browser.