Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-9]: src/usr.bin/ftp Pull up following revision(s) (requested by l...



details:   https://anonhg.NetBSD.org/src/rev/956fdd32dbaf
branches:  netbsd-9
changeset: 983930:956fdd32dbaf
user:      martin <martin%NetBSD.org@localhost>
date:      Mon Jun 14 11:34:20 2021 +0000

description:
Pull up following revision(s) (requested by lukem in ticket #1292):

        usr.bin/ftp/fetch.c: revision 1.232

fetch_url: improve signal handler restoration

Use SIG_ERR not NULL as the indicator that a signal handler
hasn't been changed, so that SIG_DFL (equivalent to NULL)
will be restored.

Fix restoration of SIGQUIT; use the old handler not SIGPIPE's.

diffstat:

 usr.bin/ftp/fetch.c |  20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diffs (59 lines):

diff -r 22c20ba1d442 -r 956fdd32dbaf usr.bin/ftp/fetch.c
--- a/usr.bin/ftp/fetch.c       Mon Jun 14 11:28:28 2021 +0000
+++ b/usr.bin/ftp/fetch.c       Mon Jun 14 11:34:20 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fetch.c,v 1.231 2019/04/04 00:36:09 christos Exp $     */
+/*     $NetBSD: fetch.c,v 1.231.2.1 2021/06/14 11:34:20 martin Exp $   */
 
 /*-
  * Copyright (c) 1997-2015 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: fetch.c,v 1.231 2019/04/04 00:36:09 christos Exp $");
+__RCSID("$NetBSD: fetch.c,v 1.231.2.1 2021/06/14 11:34:20 martin Exp $");
 #endif /* not lint */
 
 /*
@@ -1295,7 +1295,7 @@
 
        DPRINTF("%s: `%s' proxyenv `%s'\n", __func__, url, STRorNULL(penv));
 
-       oldquit = oldalrm = oldint = oldpipe = NULL;
+       oldquit = oldalrm = oldint = oldpipe = SIG_ERR;
        closefunc = NULL;
        fin = NULL;
        fout = NULL;
@@ -1572,9 +1572,9 @@
 
        bytes = 0;
        hashbytes = mark;
-       if (oldalrm) {
+       if (oldalrm != SIG_ERR) {
                (void)xsignal(SIGALRM, oldalrm);
-               oldalrm = NULL;
+               oldalrm = SIG_ERR;
        }
        progressmeter(-1);
 
@@ -1736,14 +1736,14 @@
        warnx("Improper response from `%s:%s'", ui.host, ui.port);
 
  cleanup_fetch_url:
-       if (oldint)
+       if (oldint != SIG_ERR)
                (void)xsignal(SIGINT, oldint);
-       if (oldpipe)
+       if (oldpipe != SIG_ERR)
                (void)xsignal(SIGPIPE, oldpipe);
-       if (oldalrm)
+       if (oldalrm != SIG_ERR)
                (void)xsignal(SIGALRM, oldalrm);
-       if (oldquit)
-               (void)xsignal(SIGQUIT, oldpipe);
+       if (oldquit != SIG_ERR)
+               (void)xsignal(SIGQUIT, oldquit);
        if (fin != NULL)
                fetch_close(fin);
        else if (s != -1)



Home | Main Index | Thread Index | Old Index