From a03f3e120c96ed58e6913dae3d21bdea59390c2b Mon Sep 17 00:00:00 2001 From: Jonathan Clairembault Date: Tue, 27 Nov 2012 11:09:04 +0100 Subject: login: Avoid gcc to drop exit condition because of "always false condition". --- toys/other/login.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'toys/other/login.c') diff --git a/toys/other/login.c b/toys/other/login.c index 72d7063e..54190d0f 100644 --- a/toys/other/login.c +++ b/toys/other/login.c @@ -68,8 +68,9 @@ void read_user(char * buff, int size) fflush(stdout); do { - buff[0] = getchar(); - if (buff[0] == EOF) exit(EXIT_FAILURE); + int c = getchar(); + if (c == EOF) exit(EXIT_FAILURE); + buff[0] = c; } while (isblank(buff[0])); if (buff[0] != '\n') if(!fgets(&buff[1], HOSTNAME_SIZE-1, stdin)) _exit(1); -- cgit v1.2.3