diff options
author | Jason Downs <downsj@cvs.openbsd.org> | 1996-08-08 16:22:38 +0000 |
---|---|---|
committer | Jason Downs <downsj@cvs.openbsd.org> | 1996-08-08 16:22:38 +0000 |
commit | dc0bc9a866358d277d757fa5b590a8d68f6556a7 (patch) | |
tree | bd9f08939069b1e2850f98f679e8acbbdcbf2c8b /libexec/ftpd/ftpd.c | |
parent | d6424a3ed258cc96d31be99f91da163f9a45884d (diff) |
Handle signals better.
Diffstat (limited to 'libexec/ftpd/ftpd.c')
-rw-r--r-- | libexec/ftpd/ftpd.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/libexec/ftpd/ftpd.c b/libexec/ftpd/ftpd.c index 87993500249..b3ea75d8a3f 100644 --- a/libexec/ftpd/ftpd.c +++ b/libexec/ftpd/ftpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ftpd.c,v 1.12 1996/08/07 03:27:54 downsj Exp $ */ +/* $OpenBSD: ftpd.c,v 1.13 1996/08/08 16:22:37 downsj Exp $ */ /* $NetBSD: ftpd.c,v 1.15 1995/06/03 22:46:47 mycroft Exp $ */ /* @@ -196,6 +196,7 @@ static void end_login __P((void)); static FILE *getdatasock __P((char *)); static char *gunique __P((char *)); static void lostconn __P((int)); +static void sigquit __P((int)); static int receive_data __P((FILE *, FILE *)); static void send_data __P((FILE *, FILE *, off_t, off_t, int)); static struct passwd * @@ -372,6 +373,10 @@ main(argc, argv, envp) } } + (void) signal(SIGHUP, sigquit); + (void) signal(SIGINT, sigquit); + (void) signal(SIGQUIT, sigquit); + (void) signal(SIGTERM, sigquit); (void) signal(SIGPIPE, lostconn); (void) signal(SIGCHLD, SIG_IGN); if ((long)signal(SIGURG, myoob) < 0) @@ -440,6 +445,10 @@ main(argc, argv, envp) /* NOTREACHED */ } +/* + * Signal handlers. + */ + static void lostconn(signo) int signo; @@ -450,6 +459,15 @@ lostconn(signo) dologout(-1); } +static void +sigquit(signo) + int signo; +{ + syslog(LOG_ERR, "got signal %s", strsignal(signo)); + + dologout(-1); +} + /* * Helper function for sgetpwnam(). */ |