Put some more duct tape on the last. Should fix a problem

reported by Manuel Bouyer.
This commit is contained in:
thorpej 2000-08-02 17:33:45 +00:00
parent 7310479a97
commit e6b1b2f82d
2 changed files with 13 additions and 9 deletions

View file

@ -1,6 +1,6 @@
$NetBSD: patch-sum,v 1.3 2000/08/02 05:02:14 thorpej Exp $
$NetBSD: patch-sum,v 1.4 2000/08/02 17:33:45 thorpej Exp $
MD5 (patch-aa) = b036e6deb90550cb648ec406030eb27c
MD5 (patch-ab) = 7db5d365d595a97a0f6abe5037650d47
MD5 (patch-ac) = 69d7b57b6b5f2fefbee34d01bb7226bd
MD5 (patch-ac) = 95547bc382b193e33888782c4c298c0e
MD5 (patch-ad) = 77e54c5a69059488b300f752c693744d

View file

@ -1,4 +1,4 @@
$NetBSD: patch-ac,v 1.2 2000/08/02 05:02:15 thorpej Exp $
$NetBSD: patch-ac,v 1.3 2000/08/02 17:33:45 thorpej Exp $
Make this compile on Solaris.
@ -6,7 +6,7 @@ Fix a bug where rtty would loop forever if its parent process
(such as a shell) were to die and close rtty's standard input.
--- rtty.c.orig Fri Aug 23 15:25:28 1996
+++ rtty.c Tue Aug 1 21:50:19 2000
+++ rtty.c Wed Aug 2 10:25:30 2000
@@ -35,6 +35,10 @@
#include <pwd.h>
#include <termios.h>
@ -18,11 +18,13 @@ Fix a bug where rtty would loop forever if its parent process
#include "rtty.h"
#ifdef NEED_BITYPES_H
# include "bitypes.h"
@@ -267,11 +271,12 @@
@@ -266,13 +270,16 @@
static void
tty_input(fd) {
static enum {base, need_cr, tilde} state = base;
u_char buf[1];
+ ssize_t cnt;
+ int readone = 0;
u_char buf[1];
#if 0
fcntl(Tty, F_SETFL, fcntl(Tty, F_GETFL, 0)|O_NONBLOCK);
@ -30,16 +32,18 @@ Fix a bug where rtty would loop forever if its parent process
- while (1 == read(fd, buf, 1)) {
+ while (1 == (cnt = read(fd, buf, 1))) {
u_char ch = buf[0];
+ readone = 1;
switch (state) {
@@ -346,6 +351,14 @@
case base:
@@ -346,6 +353,14 @@
write(Log, buf, 1);
}
}
+
+ if (cnt == 0) {
+ if (readone == 0 && cnt == 0) {
+ /*
+ * EOF -- get out now rather than loop forever.
+ * True EOF -- get out now rather than loop forever.
+ */
+ quit(0);
+ }