Fix signal handlers so they don't corrupt `errno'.
authormdw <mdw>
Thu, 24 Jun 1999 15:51:17 +0000 (15:51 +0000)
committermdw <mdw>
Thu, 24 Jun 1999 15:51:17 +0000 (15:51 +0000)
src/pres_curses.c
src/sw_rsh.c

index a134eac..0901df5 100644 (file)
@@ -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
  *
 /*----- 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
index 4f2be0d..0406798 100644 (file)
@@ -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@ --- *