X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=loginutils%2Flogin.c;h=70e85625b2ab60848955c646da0cc1b7c4e40d2d;hb=f2cbb03a378aa48f2e08b64877d54da3fab4ea6a;hp=ed2ab7f805f7a17723564c40a82c08cd3c856e0b;hpb=c297ea97e288da16216d5c121ddefa7b61923847;p=oweals%2Fbusybox.git diff --git a/loginutils/login.c b/loginutils/login.c index ed2ab7f80..70e85625b 100644 --- a/loginutils/login.c +++ b/loginutils/login.c @@ -225,19 +225,22 @@ static void get_username_or_die(char *buf, int size_buf) /* skip whitespace */ do { c = getchar(); - if (c == EOF) exit(EXIT_FAILURE); + if (c == EOF) + exit(EXIT_FAILURE); if (c == '\n') { - if (!--cntdown) exit(EXIT_FAILURE); + if (!--cntdown) + exit(EXIT_FAILURE); goto prompt; } - } while (isspace(c)); + } while (isspace(c)); /* maybe isblank? */ *buf++ = c; if (!fgets(buf, size_buf-2, stdin)) exit(EXIT_FAILURE); if (!strchr(buf, '\n')) exit(EXIT_FAILURE); - while (isgraph(*buf)) buf++; + while ((unsigned char)*buf > ' ') + buf++; *buf = '\0'; }