summaryrefslogtreecommitdiff
path: root/libexec/ftpd/ftpd.c
diff options
context:
space:
mode:
authorDan Harnett <danh@cvs.openbsd.org>2002-06-17 19:33:38 +0000
committerDan Harnett <danh@cvs.openbsd.org>2002-06-17 19:33:38 +0000
commitbfae27c1c947f622bb9f1e1cc33987d0b3818169 (patch)
treeddfa9d41dbec8e7c542dc45154c86b1993d349f8 /libexec/ftpd/ftpd.c
parentd27320aa6ec1696185c414c78ff94550b5126a50 (diff)
Initialize SIGALRM handler once in main(), instead of in several
different locations. This fixes a problem where the SIGALRM handler was being set to an uninitialized pointer in receive_data(). Originally reported to the misc@ list by Colin Harford. ok millert@
Diffstat (limited to 'libexec/ftpd/ftpd.c')
-rw-r--r--libexec/ftpd/ftpd.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/libexec/ftpd/ftpd.c b/libexec/ftpd/ftpd.c
index 4a7c4014708..abbd44184ac 100644
--- a/libexec/ftpd/ftpd.c
+++ b/libexec/ftpd/ftpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ftpd.c,v 1.128 2002/06/09 00:37:37 itojun Exp $ */
+/* $OpenBSD: ftpd.c,v 1.129 2002/06/17 19:33:37 danh Exp $ */
/* $NetBSD: ftpd.c,v 1.15 1995/06/03 22:46:47 mycroft Exp $ */
/*
@@ -73,7 +73,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)ftpd.c 8.4 (Berkeley) 4/16/94";
#else
-static char rcsid[] = "$OpenBSD: ftpd.c,v 1.128 2002/06/09 00:37:37 itojun Exp $";
+static char rcsid[] = "$OpenBSD: ftpd.c,v 1.129 2002/06/17 19:33:37 danh Exp $";
#endif
#endif /* not lint */
@@ -494,6 +494,9 @@ main(argc, argv, envp)
sa.sa_handler = lostconn;
(void) sigaction(SIGPIPE, &sa, NULL);
+ sa.sa_handler = toolong;
+ (void) sigaction(SIGALRM, &sa, NULL);
+
addrlen = sizeof(ctrl_addr);
if (getsockname(0, (struct sockaddr *)&ctrl_addr, &addrlen) < 0) {
syslog(LOG_ERR, "getsockname: %m");
@@ -1361,7 +1364,6 @@ dataconn(name, size, mode)
union sockunion from;
int s, fromlen = sizeof(from);
- signal (SIGALRM, toolong);
(void) alarm ((unsigned) timeout);
s = accept(pdata, (struct sockaddr *)&from, &fromlen);
(void) alarm (0);
@@ -1621,7 +1623,6 @@ receive_data(instr, outstr)
int c;
int cnt;
char buf[BUFSIZ];
- struct sigaction sa;
volatile int bare_lfs = 0;
transflag++;
@@ -1629,10 +1630,6 @@ receive_data(instr, outstr)
case TYPE_I:
case TYPE_L:
- sigfillset(&sa.sa_mask);
- sa.sa_flags = SA_RESTART;
- sigaction(SIGALRM, &sa, NULL);
-
do {
(void) alarm ((unsigned) timeout);
cnt = read(fileno(instr), buf, sizeof(buf));