summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1997-08-05 22:22:59 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1997-08-05 22:22:59 +0000
commit285618ff4bb8510cd68164d23f8de74d740d6ce8 (patch)
treeb25ee9328017698113c7c629edb3809718ac59e8 /bin
parent9788e3d94e7241f57b76257d410662d813dee9df (diff)
make signal handlers errno safe
Diffstat (limited to 'bin')
-rw-r--r--bin/csh/csh.c7
-rw-r--r--bin/dd/misc.c6
-rw-r--r--bin/ed/main.c13
-rw-r--r--bin/ksh/trap.c4
-rw-r--r--bin/pdksh/trap.c4
5 files changed, 24 insertions, 10 deletions
diff --git a/bin/csh/csh.c b/bin/csh/csh.c
index b971a1bef77..92c910d4c97 100644
--- a/bin/csh/csh.c
+++ b/bin/csh/csh.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: csh.c,v 1.7 1997/07/25 18:57:59 mickey Exp $ */
+/* $OpenBSD: csh.c,v 1.8 1997/08/05 22:22:51 deraadt Exp $ */
/* $NetBSD: csh.c,v 1.14 1995/04/29 23:21:28 mycroft Exp $ */
/*-
@@ -44,7 +44,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)csh.c 8.2 (Berkeley) 10/12/93";
#else
-static char rcsid[] = "$OpenBSD: csh.c,v 1.7 1997/07/25 18:57:59 mickey Exp $";
+static char rcsid[] = "$OpenBSD: csh.c,v 1.8 1997/08/05 22:22:51 deraadt Exp $";
#endif
#endif /* not lint */
@@ -930,7 +930,10 @@ void
pintr(notused)
int notused;
{
+ int save_errno = errno;
+
pintr1(1);
+ errno = save_errno;
}
void
diff --git a/bin/dd/misc.c b/bin/dd/misc.c
index 4c501a64cee..48878444c58 100644
--- a/bin/dd/misc.c
+++ b/bin/dd/misc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: misc.c,v 1.4 1997/02/14 07:05:21 millert Exp $ */
+/* $OpenBSD: misc.c,v 1.5 1997/08/05 22:22:53 deraadt Exp $ */
/* $NetBSD: misc.c,v 1.4 1995/03/21 09:04:10 cgd Exp $ */
/*-
@@ -42,7 +42,7 @@
#if 0
static char sccsid[] = "@(#)misc.c 8.3 (Berkeley) 4/2/94";
#else
-static char rcsid[] = "$OpenBSD: misc.c,v 1.4 1997/02/14 07:05:21 millert Exp $";
+static char rcsid[] = "$OpenBSD: misc.c,v 1.5 1997/08/05 22:22:53 deraadt Exp $";
#endif
#endif /* not lint */
@@ -93,8 +93,10 @@ void
summaryx(notused)
int notused;
{
+ int save_errno = errno;
summary();
+ errno = save_errno;
}
/* ARGSUSED */
diff --git a/bin/ed/main.c b/bin/ed/main.c
index 01c0bbfde58..9f665385ea8 100644
--- a/bin/ed/main.c
+++ b/bin/ed/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.10 1997/07/23 14:42:33 kstailey Exp $ */
+/* $OpenBSD: main.c,v 1.11 1997/08/05 22:22:55 deraadt Exp $ */
/* $NetBSD: main.c,v 1.3 1995/03/21 09:04:44 cgd Exp $ */
/* main.c: This file contains the main control and user-interface routines
@@ -39,7 +39,7 @@ char *copyright =
#if 0
static char *rcsid = "@(#)main.c,v 1.1 1994/02/01 00:34:42 alm Exp";
#else
-static char rcsid[] = "$OpenBSD: main.c,v 1.10 1997/07/23 14:42:33 kstailey Exp $";
+static char rcsid[] = "$OpenBSD: main.c,v 1.11 1997/08/05 22:22:55 deraadt Exp $";
#endif
#endif /* not lint */
@@ -1371,7 +1371,8 @@ signal_hup(signo)
{
if (mutex)
sigflags |= (1 << (signo - 1));
- else handle_hup(signo);
+ else
+ handle_hup(signo);
}
@@ -1381,7 +1382,8 @@ signal_int(signo)
{
if (mutex)
sigflags |= (1 << (signo - 1));
- else handle_int(signo);
+ else
+ handle_int(signo);
}
@@ -1431,6 +1433,8 @@ void
handle_winch(signo)
int signo;
{
+ int save_errno = errno;
+
struct winsize ws; /* window size structure */
sigflags &= ~(1 << (signo - 1));
@@ -1438,6 +1442,7 @@ handle_winch(signo)
if (ws.ws_row > 2) rows = ws.ws_row - 2;
if (ws.ws_col > 8) cols = ws.ws_col - 8;
}
+ errno = save_errno;
}
diff --git a/bin/ksh/trap.c b/bin/ksh/trap.c
index 89640ef1d1a..9bb07c57dbd 100644
--- a/bin/ksh/trap.c
+++ b/bin/ksh/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.4 1997/06/19 13:58:48 kstailey Exp $ */
+/* $OpenBSD: trap.c,v 1.5 1997/08/05 22:22:58 deraadt Exp $ */
/*
* signal handling
@@ -111,6 +111,7 @@ trapsig(i)
int i;
{
Trap *p = &sigtraps[i];
+ int save_errno = errno;
trap = p->set = 1;
if (p->flags & TF_DFL_INTR)
@@ -125,6 +126,7 @@ trapsig(i)
if (sigtraps[i].cursig == trapsig) /* this for SIGCHLD,SIGALRM */
sigaction(i, &Sigact_trap, (struct sigaction *) 0);
#endif /* V7_SIGNALS */
+ errno = save_errno;
return RETSIGVAL;
}
diff --git a/bin/pdksh/trap.c b/bin/pdksh/trap.c
index 89640ef1d1a..9bb07c57dbd 100644
--- a/bin/pdksh/trap.c
+++ b/bin/pdksh/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.4 1997/06/19 13:58:48 kstailey Exp $ */
+/* $OpenBSD: trap.c,v 1.5 1997/08/05 22:22:58 deraadt Exp $ */
/*
* signal handling
@@ -111,6 +111,7 @@ trapsig(i)
int i;
{
Trap *p = &sigtraps[i];
+ int save_errno = errno;
trap = p->set = 1;
if (p->flags & TF_DFL_INTR)
@@ -125,6 +126,7 @@ trapsig(i)
if (sigtraps[i].cursig == trapsig) /* this for SIGCHLD,SIGALRM */
sigaction(i, &Sigact_trap, (struct sigaction *) 0);
#endif /* V7_SIGNALS */
+ errno = save_errno;
return RETSIGVAL;
}