summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>1998-05-13 08:59:07 +0000
committerderaadt <deraadt@openbsd.org>1998-05-13 08:59:07 +0000
commit1b7fd8a07642fc640300097a44c673d36d3bbb74 (patch)
tree10754579422515bf6569270f6d5e8430016ecd40
parentdocument SA_RESETHAND; erh@uaccess.net (diff)
downloadwireguard-openbsd-1b7fd8a07642fc640300097a44c673d36d3bbb74.tar.xz
wireguard-openbsd-1b7fd8a07642fc640300097a44c673d36d3bbb74.zip
make signal handlers save/restore errno
-rw-r--r--usr.bin/ftp/ftp.c6
-rw-r--r--usr.bin/ftp/main.c7
-rw-r--r--usr.bin/ftp/util.c8
3 files changed, 15 insertions, 6 deletions
diff --git a/usr.bin/ftp/ftp.c b/usr.bin/ftp/ftp.c
index 342efadf7d0..359ee23fd1c 100644
--- a/usr.bin/ftp/ftp.c
+++ b/usr.bin/ftp/ftp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ftp.c,v 1.25 1998/02/10 02:13:10 weingart Exp $ */
+/* $OpenBSD: ftp.c,v 1.26 1998/05/13 08:59:07 deraadt Exp $ */
/* $NetBSD: ftp.c,v 1.27 1997/08/18 10:20:23 lukem Exp $ */
/*
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)ftp.c 8.6 (Berkeley) 10/27/94";
#else
-static char rcsid[] = "$OpenBSD: ftp.c,v 1.25 1998/02/10 02:13:10 weingart Exp $";
+static char rcsid[] = "$OpenBSD: ftp.c,v 1.26 1998/05/13 08:59:07 deraadt Exp $";
#endif
#endif /* not lint */
@@ -1256,9 +1256,11 @@ void
psummary(notused)
int notused;
{
+ int save_errno = errno;
if (bytes > 0)
ptransfer(1);
+ errno = save_errno;
}
void
diff --git a/usr.bin/ftp/main.c b/usr.bin/ftp/main.c
index e25927d7ceb..ed508d90682 100644
--- a/usr.bin/ftp/main.c
+++ b/usr.bin/ftp/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.38 1998/02/17 23:22:56 millert Exp $ */
+/* $OpenBSD: main.c,v 1.39 1998/05/13 08:59:08 deraadt Exp $ */
/* $NetBSD: main.c,v 1.24 1997/08/18 10:20:26 lukem Exp $ */
/*
@@ -44,7 +44,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 10/9/94";
#else
-static char rcsid[] = "$OpenBSD: main.c,v 1.38 1998/02/17 23:22:56 millert Exp $";
+static char rcsid[] = "$OpenBSD: main.c,v 1.39 1998/05/13 08:59:08 deraadt Exp $";
#endif
#endif /* not lint */
@@ -59,6 +59,7 @@ static char rcsid[] = "$OpenBSD: main.c,v 1.38 1998/02/17 23:22:56 millert Exp $
#include <netdb.h>
#include <pwd.h>
#include <stdio.h>
+#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
@@ -331,6 +332,7 @@ intr()
void
lostpeer()
{
+ int save_errno = errno;
alarmtimer(0);
if (connected) {
@@ -357,6 +359,7 @@ lostpeer()
}
proxflag = 0;
pswitch(0);
+ errno = save_errno;
}
/*
diff --git a/usr.bin/ftp/util.c b/usr.bin/ftp/util.c
index 8271b179392..8e44146637d 100644
--- a/usr.bin/ftp/util.c
+++ b/usr.bin/ftp/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.18 1998/04/26 17:52:15 deraadt Exp $ */
+/* $OpenBSD: util.c,v 1.19 1998/05/13 08:59:10 deraadt Exp $ */
/* $NetBSD: util.c,v 1.12 1997/08/18 10:20:27 lukem Exp $ */
/*
@@ -35,7 +35,7 @@
*/
#ifndef lint
-static char rcsid[] = "$OpenBSD: util.c,v 1.18 1998/04/26 17:52:15 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: util.c,v 1.19 1998/05/13 08:59:10 deraadt Exp $";
#endif /* not lint */
/*
@@ -605,9 +605,11 @@ void
updateprogressmeter(dummy)
int dummy;
{
+ int save_errno = errno;
if (foregroundproc())
progressmeter(0);
+ errno = save_errno;
}
/*
@@ -816,12 +818,14 @@ void
setttywidth(a)
int a;
{
+ int save_errno = errno;
struct winsize winsize;
if (ioctl(fileno(ttyout), TIOCGWINSZ, &winsize) != -1)
ttywidth = winsize.ws_col;
else
ttywidth = 80;
+ errno = save_errno;
}
/*