pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/net/tnftp/files/src apply fix from NetBSD-current for ...
details: https://anonhg.NetBSD.org/pkgsrc/rev/f3ee15b95b36
branches: trunk
changeset: 478612:f3ee15b95b36
user: grant <grant%pkgsrc.org@localhost>
date: Tue Jul 27 10:25:09 2004 +0000
description:
apply fix from NetBSD-current for SIGINT handling. ok'd by lukem.
diffstat:
net/tnftp/files/src/cmds.c | 13 +++++++------
net/tnftp/files/src/fetch.c | 11 +++++++----
net/tnftp/files/src/ftp.c | 16 +++++++++++-----
net/tnftp/files/src/ftp_var.h | 5 +++--
net/tnftp/files/src/main.c | 19 +++++++++++++------
net/tnftp/files/src/util.c | 9 +++++----
6 files changed, 46 insertions(+), 27 deletions(-)
diffs (284 lines):
diff -r 602e706a07bd -r f3ee15b95b36 net/tnftp/files/src/cmds.c
--- a/net/tnftp/files/src/cmds.c Tue Jul 27 09:57:57 2004 +0000
+++ b/net/tnftp/files/src/cmds.c Tue Jul 27 10:25:09 2004 +0000
@@ -1,7 +1,7 @@
-/* $NetBSD: cmds.c,v 1.1 2004/03/11 13:01:01 grant Exp $ */
+/* $NetBSD: cmds.c,v 1.2 2004/07/27 10:25:09 grant Exp $ */
/*-
- * Copyright (c) 1996-2002 The NetBSD Foundation, Inc.
+ * Copyright (c) 1996-2004 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@@ -108,7 +108,7 @@
#if 0
static char sccsid[] = "@(#)cmds.c 8.6 (Berkeley) 10/9/94";
#else
-__RCSID("$NetBSD: cmds.c,v 1.1 2004/03/11 13:01:01 grant Exp $");
+__RCSID("$NetBSD: cmds.c,v 1.2 2004/07/27 10:25:09 grant Exp $");
#endif
#endif /* not lint */
#endif
@@ -1388,7 +1388,7 @@
shell(int argc, char *argv[])
{
pid_t pid;
- sigfunc old1;
+ sigfunc oldintr;
char shellnam[MAXPATHLEN], *shell, *namep;
int wait_status;
@@ -1397,7 +1397,7 @@
code = -1;
return;
}
- old1 = xsignal(SIGINT, SIG_IGN);
+ oldintr = xsignal(SIGINT, SIG_IGN);
if ((pid = fork()) == 0) {
for (pid = 3; pid < 20; pid++)
(void)close(pid);
@@ -1428,7 +1428,7 @@
if (pid > 0)
while (wait(&wait_status) != pid)
;
- (void)xsignal(SIGINT, old1);
+ (void)xsignal(SIGINT, oldintr);
if (pid == -1) {
warn("Try again later");
code = -1;
@@ -1778,6 +1778,7 @@
proxabort(int notused)
{
+ sigint_raised = 1;
alarmtimer(0);
if (!proxy) {
pswitch(1);
diff -r 602e706a07bd -r f3ee15b95b36 net/tnftp/files/src/fetch.c
--- a/net/tnftp/files/src/fetch.c Tue Jul 27 09:57:57 2004 +0000
+++ b/net/tnftp/files/src/fetch.c Tue Jul 27 10:25:09 2004 +0000
@@ -1,7 +1,7 @@
-/* $NetBSD: fetch.c,v 1.1 2004/03/11 13:01:01 grant Exp $ */
+/* $NetBSD: fetch.c,v 1.2 2004/07/27 10:25:09 grant Exp $ */
/*-
- * Copyright (c) 1997-2003 The NetBSD Foundation, Inc.
+ * Copyright (c) 1997-2004 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@@ -42,7 +42,7 @@
#if 0
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: fetch.c,v 1.1 2004/03/11 13:01:01 grant Exp $");
+__RCSID("$NetBSD: fetch.c,v 1.2 2004/07/27 10:25:09 grant Exp $");
#endif /* not lint */
#endif
@@ -1254,6 +1254,7 @@
char msgbuf[100];
int len;
+ sigint_raised = 1;
alarmtimer(0);
len = strlcpy(msgbuf, "\nHTTP fetch aborted.\n", sizeof(msgbuf));
write(fileno(ttyout), msgbuf, len);
@@ -1677,7 +1678,9 @@
if (sigsetjmp(toplevel, 1)) {
if (connected)
disconnect(0, NULL);
- return (argpos + 1);
+ if (rval > 0)
+ rval = argpos + 1;
+ return (rval);
}
(void)xsignal(SIGINT, intr);
(void)xsignal(SIGPIPE, lostpeer);
diff -r 602e706a07bd -r f3ee15b95b36 net/tnftp/files/src/ftp.c
--- a/net/tnftp/files/src/ftp.c Tue Jul 27 09:57:57 2004 +0000
+++ b/net/tnftp/files/src/ftp.c Tue Jul 27 10:25:09 2004 +0000
@@ -1,7 +1,7 @@
-/* $NetBSD: ftp.c,v 1.1 2004/03/11 13:01:01 grant Exp $ */
+/* $NetBSD: ftp.c,v 1.2 2004/07/27 10:25:09 grant Exp $ */
/*-
- * Copyright (c) 1996-2002 The NetBSD Foundation, Inc.
+ * Copyright (c) 1996-2004 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@@ -106,7 +106,7 @@
#if 0
static char sccsid[] = "@(#)ftp.c 8.6 (Berkeley) 10/27/94";
#else
-__RCSID("$NetBSD: ftp.c,v 1.1 2004/03/11 13:01:01 grant Exp $");
+__RCSID("$NetBSD: ftp.c,v 1.2 2004/07/27 10:25:09 grant Exp $");
#endif
#endif /* not lint */
#endif
@@ -115,8 +115,9 @@
#include "ftp_var.h"
-volatile int abrtflag = 0;
-volatile int timeoutflag = 0;
+volatile sig_atomic_t abrtflag;
+volatile sig_atomic_t timeoutflag;
+
sigjmp_buf ptabort;
int ptabflg;
int ptflag = 0;
@@ -304,6 +305,7 @@
{
int oerrno = errno;
+ sigint_raised = 1;
alarmtimer(0);
if (fromatty)
write(fileno(ttyout), "\n", 1);
@@ -587,6 +589,7 @@
char msgbuf[100];
int len;
+ sigint_raised = 1;
alarmtimer(0);
mflag = 0;
abrtflag = 0;
@@ -1725,6 +1728,7 @@
{
int oerrno = errno;
+ sigint_raised = 1;
alarmtimer(0);
abrtflag++;
errno = oerrno;
@@ -1821,6 +1825,7 @@
abortpt(int notused)
{
+ sigint_raised = 1;
alarmtimer(0);
if (fromatty)
write(fileno(ttyout), "\n", 1);
@@ -2039,6 +2044,7 @@
char msgbuf[100];
int len;
+ sigint_raised = 1;
alarmtimer(0);
len = strlcpy(msgbuf, "\nremote abort aborted; closing connection.\n",
sizeof(msgbuf));
diff -r 602e706a07bd -r f3ee15b95b36 net/tnftp/files/src/ftp_var.h
--- a/net/tnftp/files/src/ftp_var.h Tue Jul 27 09:57:57 2004 +0000
+++ b/net/tnftp/files/src/ftp_var.h Tue Jul 27 10:25:09 2004 +0000
@@ -1,7 +1,7 @@
-/* $NetBSD: ftp_var.h,v 1.1 2004/03/11 13:01:01 grant Exp $ */
+/* $NetBSD: ftp_var.h,v 1.2 2004/07/27 10:25:09 grant Exp $ */
/*-
- * Copyright (c) 1996-2003 The NetBSD Foundation, Inc.
+ * Copyright (c) 1996-2004 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@@ -306,6 +306,7 @@
* first (`xxx-') and last (`xxx ')
*/
+GLOBAL volatile sig_atomic_t sigint_raised;
GLOBAL FILE *cin;
GLOBAL FILE *cout;
diff -r 602e706a07bd -r f3ee15b95b36 net/tnftp/files/src/main.c
--- a/net/tnftp/files/src/main.c Tue Jul 27 09:57:57 2004 +0000
+++ b/net/tnftp/files/src/main.c Tue Jul 27 10:25:09 2004 +0000
@@ -1,7 +1,7 @@
-/* $NetBSD: main.c,v 1.1 2004/03/11 13:01:01 grant Exp $ */
+/* $NetBSD: main.c,v 1.2 2004/07/27 10:25:09 grant Exp $ */
/*-
- * Copyright (c) 1996-2002 The NetBSD Foundation, Inc.
+ * Copyright (c) 1996-2004 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@@ -109,7 +109,7 @@
#if 0
static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 10/9/94";
#else
-__RCSID("$NetBSD: main.c,v 1.1 2004/03/11 13:01:01 grant Exp $");
+__RCSID("$NetBSD: main.c,v 1.2 2004/07/27 10:25:09 grant Exp $");
#endif
#endif /* not lint */
#endif
@@ -144,6 +144,8 @@
#endif
setprogname(argv[0]);
+ sigint_raised = 0;
+
ftpport = "ftp";
httpport = "http";
gateport = NULL;
@@ -498,17 +500,22 @@
if (argc > 0) {
if (isupload) {
rval = auto_put(argc, argv, upload_path);
+ sigint_or_rval_exit:
+ if (sigint_raised) {
+ (void)xsignal(SIGINT, SIG_DFL);
+ raise(SIGINT);
+ }
exit(rval);
} else if (strchr(argv[0], ':') != NULL
&& ! isipv6addr(argv[0])) {
rval = auto_fetch(argc, argv);
if (rval >= 0) /* -1 == connected and cd-ed */
- exit(rval);
+ goto sigint_or_rval_exit;
} else {
char *xargv[4], *user, *host;
- if (sigsetjmp(toplevel, 1))
- exit(0);
+ if ((rval = sigsetjmp(toplevel, 1)))
+ goto sigint_or_rval_exit;
(void)xsignal(SIGINT, intr);
(void)xsignal(SIGPIPE, lostpeer);
user = NULL;
diff -r 602e706a07bd -r f3ee15b95b36 net/tnftp/files/src/util.c
--- a/net/tnftp/files/src/util.c Tue Jul 27 09:57:57 2004 +0000
+++ b/net/tnftp/files/src/util.c Tue Jul 27 10:25:09 2004 +0000
@@ -1,7 +1,7 @@
-/* $NetBSD: util.c,v 1.1 2004/03/11 13:01:01 grant Exp $ */
+/* $NetBSD: util.c,v 1.2 2004/07/27 10:25:09 grant Exp $ */
/*-
- * Copyright (c) 1997-2003 The NetBSD Foundation, Inc.
+ * Copyright (c) 1997-2004 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@@ -76,7 +76,7 @@
#if 0
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: util.c,v 1.1 2004/03/11 13:01:01 grant Exp $");
+__RCSID("$NetBSD: util.c,v 1.2 2004/07/27 10:25:09 grant Exp $");
#endif /* not lint */
#endif
@@ -304,9 +304,10 @@
* Top-level signal handler for interrupted commands.
*/
void
-intr(int dummy)
+intr(int signo)
{
+ sigint_raised = 1;
alarmtimer(0);
if (fromatty)
write(fileno(ttyout), "\n", 1);
Home |
Main Index |
Thread Index |
Old Index