Mercurial > hg > toybox
changeset 718:0ed3351d91eb
login: Avoid gcc to drop exit condition because of "always false condition".
author | Jonathan Clairembault <jonathan@clairembault.fr> |
---|---|
date | Tue, 27 Nov 2012 11:09:04 +0100 |
parents | 54294a48a09b |
children | 053061a0b5b6 |
files | toys/other/login.c |
diffstat | 1 files changed, 3 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/toys/other/login.c Tue Nov 27 13:55:57 2012 -0600 +++ b/toys/other/login.c Tue Nov 27 11:09:04 2012 +0100 @@ -68,8 +68,9 @@ 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);