From e06856cc19369a6d1c36efbef77c90d975d298d7 Mon Sep 17 00:00:00 2001 From: Steve Slaven Date: Wed, 8 Nov 2006 17:12:03 +0000 Subject: This fixed #bind and #rebind problems, patch from kalev lember diff --git a/cmd2.c b/cmd2.c index 8e6a110..1b9b1be 100644 --- a/cmd2.c +++ b/cmd2.c @@ -1054,7 +1054,7 @@ static int get_one_char __P1 (int,timeout) timeoutbuf.tv_usec = timeout * uSEC_PER_mSEC; err = select(tty_read_fd+1, &fds, NULL, NULL, timeout ? &timeoutbuf : NULL); - if (err == 0 || (err == -1 && errno == EINTR)) + if (err == -1 && errno == EINTR) return -1; if (err == -1) { errmsg("select"); @@ -1062,6 +1062,9 @@ static int get_one_char __P1 (int,timeout) } while ((err = tty_read(&c, 1)) < 0 && errno == EINTR) ; + if (err != 1 && errno == EAGAIN) { + return -1; + } if (err != 1) { errmsg("read from tty"); return -1; -- cgit v0.10.2