summaryrefslogtreecommitdiff
path: root/sysutils
diff options
context:
space:
mode:
authorthorpej <thorpej@pkgsrc.org>2000-08-02 05:02:14 +0000
committerthorpej <thorpej@pkgsrc.org>2000-08-02 05:02:14 +0000
commit12b245d679b9aa6befb174c4e4a41f6b06923f10 (patch)
tree7735cef988fcb585c985e9ff4718f22908d8167e /sysutils
parentf5917aea2ce5177ea6ff74d60693014b45872fca (diff)
downloadpkgsrc-12b245d679b9aa6befb174c4e4a41f6b06923f10.tar.gz
Fix a bug in the rtty client which would cause the rtty process to
loop forever (consuming a lot of CPU) if the parent process (e.g. shell) were to suddenly die -- rtty was not properly checking for the EOF condition. Patch from Andrew Flury <aflury@zembu.com>.
Diffstat (limited to 'sysutils')
-rw-r--r--sysutils/rtty/files/patch-sum4
-rw-r--r--sysutils/rtty/patches/patch-ac38
2 files changed, 37 insertions, 5 deletions
diff --git a/sysutils/rtty/files/patch-sum b/sysutils/rtty/files/patch-sum
index 7ce150c8137..b6194eb6125 100644
--- a/sysutils/rtty/files/patch-sum
+++ b/sysutils/rtty/files/patch-sum
@@ -1,6 +1,6 @@
-$NetBSD: patch-sum,v 1.2 2000/06/13 22:20:41 thorpej Exp $
+$NetBSD: patch-sum,v 1.3 2000/08/02 05:02:14 thorpej Exp $
MD5 (patch-aa) = b036e6deb90550cb648ec406030eb27c
MD5 (patch-ab) = 7db5d365d595a97a0f6abe5037650d47
-MD5 (patch-ac) = 96370fc8d3e68691bc4a73f03337d8e4
+MD5 (patch-ac) = 69d7b57b6b5f2fefbee34d01bb7226bd
MD5 (patch-ad) = 77e54c5a69059488b300f752c693744d
diff --git a/sysutils/rtty/patches/patch-ac b/sysutils/rtty/patches/patch-ac
index 9612bae72e7..92618224abb 100644
--- a/sysutils/rtty/patches/patch-ac
+++ b/sysutils/rtty/patches/patch-ac
@@ -1,9 +1,12 @@
-$NetBSD: patch-ac,v 1.1 1999/04/09 08:33:51 agc Exp $
+$NetBSD: patch-ac,v 1.2 2000/08/02 05:02:15 thorpej Exp $
Make this compile on Solaris.
---- rtty.c 1999/04/09 08:29:25 1.1
-+++ rtty.c 1999/04/09 08:30:06
+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
@@ -35,6 +35,10 @@
#include <pwd.h>
#include <termios.h>
@@ -15,3 +18,32 @@ Make this compile on Solaris.
#include "rtty.h"
#ifdef NEED_BITYPES_H
# include "bitypes.h"
+@@ -267,11 +271,12 @@
+ tty_input(fd) {
+ static enum {base, need_cr, tilde} state = base;
+ u_char buf[1];
++ ssize_t cnt;
+
+ #if 0
+ fcntl(Tty, F_SETFL, fcntl(Tty, F_GETFL, 0)|O_NONBLOCK);
+ #endif
+- while (1 == read(fd, buf, 1)) {
++ while (1 == (cnt = read(fd, buf, 1))) {
+ u_char ch = buf[0];
+
+ switch (state) {
+@@ -346,6 +351,14 @@
+ write(Log, buf, 1);
+ }
+ }
++
++ if (cnt == 0) {
++ /*
++ * EOF -- get out now rather than loop forever.
++ */
++ quit(0);
++ }
++
+ #if 0
+ fcntl(Tty, F_SETFL, fcntl(Tty, F_GETFL, 0)&~O_NONBLOCK);
+ #endif