From 3d1aae1af6607bf0cc16fa6d3730026bb2c41e42 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Tue, 21 Nov 2000 07:22:20 +0000 Subject: errno saving inside really crummy signal handlers --- usr.bin/top/top.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'usr.bin/top/top.c') diff --git a/usr.bin/top/top.c b/usr.bin/top/top.c index dbb0d6a7b75..e1dc1ab5eea 100644 --- a/usr.bin/top/top.c +++ b/usr.bin/top/top.c @@ -1,4 +1,4 @@ -/* $OpenBSD: top.c,v 1.4 2000/10/04 21:19:38 millert Exp $ */ +/* $OpenBSD: top.c,v 1.5 2000/11/21 07:22:19 deraadt Exp $ */ const char copyright[] = "Copyright (c) 1984 through 1996, William LeFebvre"; @@ -38,6 +38,7 @@ const char copyright[] = "Copyright (c) 1984 through 1996, William LeFebvre"; #include #include #include +#include #include /* includes specific to top */ @@ -903,6 +904,8 @@ void tstop(i) /* SIGTSTP handler */ int i; { + int save_errno = errno; + /* move to the lower left */ end_screen(); fflush(stdout); @@ -924,6 +927,8 @@ int i; /* reinit screen */ reinit_screen(); + errno = save_errno; + /* jump to appropriate place */ longjmp(jmp_int, 1); @@ -936,6 +941,8 @@ void winch(i) /* SIGWINCH handler */ int i; { + int save_errno = errno; + /* reascertain the screen dimensions */ get_screensize(); @@ -945,6 +952,8 @@ int i; /* reset the signal handler */ (void) signal(SIGWINCH, winch); + errno = save_errno; + /* jump to appropriate place */ longjmp(jmp_int, 1); } -- cgit v1.2.3