summaryrefslogtreecommitdiff
path: root/sbin/ldattach
diff options
context:
space:
mode:
authorMarc Balmer <mbalmer@cvs.openbsd.org>2008-06-10 18:28:59 +0000
committerMarc Balmer <mbalmer@cvs.openbsd.org>2008-06-10 18:28:59 +0000
commit37269a1d279aead640e0a0c973505e43799cdedb (patch)
tree3ec85b146bcd716dc0a8feb6fe22231a593affa6 /sbin/ldattach
parent6ce866e55e624d4bdae3585bd23e6288f10ab7d1 (diff)
sleep if the slave device of the pty(4) is not connected.
problem noticed by ckuethe, solution discussed with claudio
Diffstat (limited to 'sbin/ldattach')
-rw-r--r--sbin/ldattach/ldattach.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/sbin/ldattach/ldattach.c b/sbin/ldattach/ldattach.c
index d50a597da44..0d21ad9886f 100644
--- a/sbin/ldattach/ldattach.c
+++ b/sbin/ldattach/ldattach.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldattach.c,v 1.8 2008/06/10 00:25:03 mbalmer Exp $ */
+/* $OpenBSD: ldattach.c,v 1.9 2008/06/10 18:28:58 mbalmer Exp $ */
/*
* Copyright (c) 2007, 2008 Marc Balmer <mbalmer@openbsd.org>
@@ -80,9 +80,14 @@ relay(int device, int pty)
syslog(LOG_ERR, "polling error");
exit(1);
}
- if (nfds == 0)
+ if (nfds == 0) /* should not happen */
continue;
+ if (pfd[1].revents & POLLHUP) { /* slave device not connected */
+ sleep(1);
+ continue;
+ }
+
for (n = 0; n < 2; n++) {
if (!(pfd[n].revents & POLLRDNORM))
continue;
@@ -269,7 +274,7 @@ main(int argc, char *argv[])
warnx("TIOCSTSTAMP");
goto bail_out;
}
- tty.c_cc[VMIN] = tty.c_cc[VTIME] = 0;
+ /* tty.c_cc[VMIN] = tty.c_cc[VTIME] = 0; */
tty.c_iflag = 0;
tty.c_lflag = 0;
tty.c_oflag = 0;