From 6312480608563d7d10da23e51cba9f433f7b7a01 Mon Sep 17 00:00:00 2001 From: mdw Date: Thu, 24 Jun 1999 15:51:17 +0000 Subject: [PATCH] Fix signal handlers so they don't corrupt `errno'. --- src/pres_curses.c | 16 +++++++++++++--- src/sw_rsh.c | 7 ++++++- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/pres_curses.c b/src/pres_curses.c index a134eac..0901df5 100644 --- a/src/pres_curses.c +++ b/src/pres_curses.c @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: pres_curses.c,v 1.1 1999/06/02 16:53:35 mdw Exp $ + * $Id: pres_curses.c,v 1.2 1999/06/24 15:51:16 mdw Exp $ * * Curses-based output presentation * @@ -29,8 +29,11 @@ /*----- Revision history --------------------------------------------------* * * $Log: pres_curses.c,v $ - * Revision 1.1 1999/06/02 16:53:35 mdw - * Initial revision + * Revision 1.2 1999/06/24 15:51:16 mdw + * Fix signal handlers so they don't corrupt `errno'. + * + * Revision 1.1.1.1 1999/06/02 16:53:35 mdw + * Initial import. * */ @@ -121,7 +124,9 @@ static void sizes(void) #ifdef SIGTSTP static void sig_tstp(int s) { + int e = errno; endwin(); + errno = e; raise(SIGSTOP); } #endif @@ -131,7 +136,9 @@ static void sig_tstp(int s) #ifdef SIGTSTP static void sig_cont(int s) { + int e = errno; wrefresh(curscr); + errno = e; } #endif @@ -142,6 +149,8 @@ static void sig_cont(int s) static void sig_winch(int s) { cwin *c; + int e = errno; + endwin(); refresh(); sizes(); @@ -153,6 +162,7 @@ static void sig_winch(int s) wnoutrefresh(c->s); } doupdate(); + errno = e; } #endif diff --git a/src/sw_rsh.c b/src/sw_rsh.c index 4f2be0d..0406798 100644 --- a/src/sw_rsh.c +++ b/src/sw_rsh.c @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: sw_rsh.c,v 1.3 1999/06/18 18:58:54 mdw Exp $ + * $Id: sw_rsh.c,v 1.4 1999/06/24 15:51:17 mdw Exp $ * * Run remote commands * @@ -29,6 +29,9 @@ /*----- Revision history --------------------------------------------------* * * $Log: sw_rsh.c,v $ + * Revision 1.4 1999/06/24 15:51:17 mdw + * Fix signal handlers so they don't corrupt `errno'. + * * Revision 1.3 1999/06/18 18:58:54 mdw * Signal handling fixes. * @@ -632,6 +635,7 @@ done: static void sigchld(int sig) { + int e = errno; #ifdef DEBUG_SIGCHLD int status; while (waitpid(-1, &status, WNOHANG) > 0) { @@ -648,6 +652,7 @@ static void sigchld(int sig) while (waitpid(-1, 0, WNOHANG) > 0) ; #endif + errno = e; } /* --- @swrsh@ --- * -- 2.11.0