Module Name: src Committed By: martin Date: Mon Jun 14 11:34:20 UTC 2021
Modified Files: src/usr.bin/ftp [netbsd-9]: fetch.c Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.231 -r1.231.2.1 src/usr.bin/ftp/fetch.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.bin/ftp/fetch.c diff -u src/usr.bin/ftp/fetch.c:1.231 src/usr.bin/ftp/fetch.c:1.231.2.1 --- src/usr.bin/ftp/fetch.c:1.231 Thu Apr 4 00:36:09 2019 +++ src/usr.bin/ftp/fetch.c Mon Jun 14 11:34:20 2021 @@ -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 @@ fetch_url(const char *url, const char *p 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 @@ fetch_url(const char *url, const char *p 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 @@ chunkerror: 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)