diff options
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/rlogin/rlogin.c | 22 | ||||
-rw-r--r-- | usr.bin/rsh/rsh.c | 7 | ||||
-rw-r--r-- | usr.bin/script/script.c | 7 | ||||
-rw-r--r-- | usr.bin/tftp/tftp.c | 7 |
4 files changed, 31 insertions, 12 deletions
diff --git a/usr.bin/rlogin/rlogin.c b/usr.bin/rlogin/rlogin.c index b10146f9a9e..67d0470318b 100644 --- a/usr.bin/rlogin/rlogin.c +++ b/usr.bin/rlogin/rlogin.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rlogin.c,v 1.15 1997/07/25 21:05:38 mickey Exp $ */ +/* $OpenBSD: rlogin.c,v 1.16 1997/08/06 06:43:40 deraadt Exp $ */ /* $NetBSD: rlogin.c,v 1.8 1995/10/05 09:07:22 mycroft Exp $ */ /* @@ -44,7 +44,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)rlogin.c 8.1 (Berkeley) 6/6/93"; #else -static char rcsid[] = "$OpenBSD: rlogin.c,v 1.15 1997/07/25 21:05:38 mickey Exp $"; +static char rcsid[] = "$OpenBSD: rlogin.c,v 1.16 1997/08/06 06:43:40 deraadt Exp $"; #endif #endif /* not lint */ @@ -445,17 +445,18 @@ catch_child(signo) int signo; { union wait status; + int save_errno = errno; int pid; for (;;) { pid = wait3((int *)&status, WNOHANG|WUNTRACED, NULL); if (pid == 0) - return; + break; /* if the child (reader) dies, just quit */ if (pid < 0 || (pid == child && !WIFSTOPPED(status))) done((int)(status.w_termsig | status.w_retcode)); } - /* NOTREACHED */ + errno = save_errno; } /* @@ -635,6 +636,7 @@ oob(signo) { struct termios tty; int atmark, n, rcvd; + int save_errno = errno; char waste[BUFSIZ], mark; rcvd = 0; @@ -649,16 +651,21 @@ oob(signo) if (rcvcnt < sizeof(rcvbuf)) { n = read(rem, rcvbuf + rcvcnt, sizeof(rcvbuf) - rcvcnt); - if (n <= 0) + if (n <= 0) { + errno = save_errno; return; + } rcvd += n; } else { n = read(rem, waste, sizeof(waste)); - if (n <= 0) + if (n <= 0) { + errno = save_errno; return; + } } continue; default: + errno = save_errno; return; } } @@ -709,6 +716,7 @@ oob(signo) */ if (rcvd && rcvstate == READING) longjmp(rcvtop, 1); + errno = save_errno; } /* reader: read from remote: line -> 1 */ @@ -809,7 +817,9 @@ void copytochild(signo) int signo; { + int save_errno = errno; (void)kill(child, SIGURG); + errno = save_errno; } void diff --git a/usr.bin/rsh/rsh.c b/usr.bin/rsh/rsh.c index 5d43207bd7d..3fd08745819 100644 --- a/usr.bin/rsh/rsh.c +++ b/usr.bin/rsh/rsh.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rsh.c,v 1.15 1997/07/25 21:05:39 mickey Exp $ */ +/* $OpenBSD: rsh.c,v 1.16 1997/08/06 06:43:41 deraadt Exp $ */ /*- * Copyright (c) 1983, 1990 The Regents of the University of California. @@ -41,7 +41,7 @@ char copyright[] = #ifndef lint /*static char sccsid[] = "from: @(#)rsh.c 5.24 (Berkeley) 7/1/91";*/ -static char rcsid[] = "$OpenBSD: rsh.c,v 1.15 1997/07/25 21:05:39 mickey Exp $"; +static char rcsid[] = "$OpenBSD: rsh.c,v 1.16 1997/08/06 06:43:41 deraadt Exp $"; #endif /* not lint */ #include <sys/types.h> @@ -406,12 +406,15 @@ void sendsig(signo) char signo; { + int save_errno = errno; + #ifdef KERBEROS if (doencrypt) (void)des_write(rfd2, &signo, 1); else #endif (void)write(rfd2, &signo, 1); + errno = save_errno; } #ifdef KERBEROS diff --git a/usr.bin/script/script.c b/usr.bin/script/script.c index d24277c2868..3fb03143b68 100644 --- a/usr.bin/script/script.c +++ b/usr.bin/script/script.c @@ -1,4 +1,4 @@ -/* $OpenBSD: script.c,v 1.8 1997/08/04 19:25:56 deraadt Exp $ */ +/* $OpenBSD: script.c,v 1.9 1997/08/06 06:43:43 deraadt Exp $ */ /* $NetBSD: script.c,v 1.3 1994/12/21 08:55:43 jtc Exp $ */ /* @@ -44,7 +44,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)script.c 8.1 (Berkeley) 6/6/93"; #endif -static char rcsid[] = "$OpenBSD: script.c,v 1.8 1997/08/04 19:25:56 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: script.c,v 1.9 1997/08/06 06:43:43 deraadt Exp $"; #endif /* not lint */ #include <sys/types.h> @@ -201,10 +201,13 @@ void scriptflush(signo) int signo; { + int save_errno = errno; + if (outcc) { (void)fflush(fscript); outcc = 0; } + errno = save_errno; } void diff --git a/usr.bin/tftp/tftp.c b/usr.bin/tftp/tftp.c index faa33f7f892..eeb57d71938 100644 --- a/usr.bin/tftp/tftp.c +++ b/usr.bin/tftp/tftp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tftp.c,v 1.3 1997/01/17 07:13:32 millert Exp $ */ +/* $OpenBSD: tftp.c,v 1.4 1997/08/06 06:43:45 deraadt Exp $ */ /* $NetBSD: tftp.c,v 1.5 1995/04/29 05:55:25 cgd Exp $ */ /* @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)tftp.c 8.1 (Berkeley) 6/6/93"; #endif -static char rcsid[] = "$OpenBSD: tftp.c,v 1.3 1997/01/17 07:13:32 millert Exp $"; +static char rcsid[] = "$OpenBSD: tftp.c,v 1.4 1997/08/06 06:43:45 deraadt Exp $"; #endif /* not lint */ /* Many bug fixes are from Jim Guyton <guyton@rand-unix> */ @@ -449,11 +449,14 @@ static void timer(sig) int sig; { + int save_errno = errno; timeout += rexmtval; if (timeout >= maxtimeout) { printf("Transfer timed out.\n"); + errno = save_errno; longjmp(toplevel, -1); } + errno = save_errno; longjmp(timeoutbuf, 1); } |