aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Slaven <bpk@hoopajoo.net>2006-02-02 21:34:46 (GMT)
committerSteve Slaven <bpk@hoopajoo.net>2006-02-02 21:34:46 (GMT)
commita0db2c2d8131162d4df09a81d6c61cb7fc836a04 (patch)
treed6178426b24bb040a771981085675111b6033a1d
parent03a51c81d204a8869710bd587d1e0e5f99eea3db (diff)
downloadpowwow-a0db2c2d8131162d4df09a81d6c61cb7fc836a04.zip
powwow-a0db2c2d8131162d4df09a81d6c61cb7fc836a04.tar.gz
powwow-a0db2c2d8131162d4df09a81d6c61cb7fc836a04.tar.bz2
Fixes crash if non-latin-1 character is entered before connecting to a
server (Dain)
-rw-r--r--main.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/main.c b/main.c
index ca4d2cf..5353873 100644
--- a/main.c
+++ b/main.c
@@ -1316,7 +1316,10 @@ static void get_user_input __P0 (void)
while ((j = tty_read(c, chunk)) < 0 && errno == EINTR)
;
- if (j <= 0 || (chunk == 1 && j != chunk))
+ if (j == 0)
+ return;
+
+ if (j < 0 || (chunk == 1 && j != chunk))
syserr("read from tty");
c[chunk] = '\0';