diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2000-11-21 07:22:20 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2000-11-21 07:22:20 +0000 |
commit | 3d1aae1af6607bf0cc16fa6d3730026bb2c41e42 (patch) | |
tree | 04861cdc0ecb805dcbc573aead7f2c6d13974739 /usr.bin/top/top.c | |
parent | dd8dd81b9c953440a52d8b7b4c3bbc1e345ea799 (diff) |
errno saving inside really crummy signal handlers
Diffstat (limited to 'usr.bin/top/top.c')
-rw-r--r-- | usr.bin/top/top.c | 11 |
1 files changed, 10 insertions, 1 deletions
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 <string.h> #include <stdlib.h> #include <unistd.h> +#include <errno.h> #include <sys/time.h> /* 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); } |