From df2b2e6922947da996079186883e852c6ede3bee Mon Sep 17 00:00:00 2001 From: "John Hodge (sonata)" Date: Thu, 1 Aug 2013 12:00:15 +0800 Subject: [PATCH] Usermode/login - Slight cleanup --- Usermode/Applications/login_src/main.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Usermode/Applications/login_src/main.c b/Usermode/Applications/login_src/main.c index 4059953f..86b18842 100644 --- a/Usermode/Applications/login_src/main.c +++ b/Usermode/Applications/login_src/main.c @@ -29,9 +29,12 @@ int main(int argc, char *argv[]) for(;;) { sUsername = GetUsername(); - if(!sUsername) continue; + if(!sUsername || !sUsername[0]) continue; sPassword = GetPassword(); - if(!sPassword) continue; + if(!sPassword) { + free(sUsername); + continue; + } if( (uid = ValidateUser(sUsername, sPassword)) == -1 ) { printf("\nInvalid username or password\n"); @@ -65,6 +68,7 @@ int main(int argc, char *argv[]) // Clear graphics mode struct ptymode mode = {.InputMode = PTYIMODE_ECHO|PTYIMODE_CANON,.OutputMode=0}; _SysIOCtl(0, PTY_IOCTL_SETMODE, &mode); + fprintf(stderr, "\x1b[R"); } return 0; @@ -117,7 +121,7 @@ char *_GetString(int bEcho) mode.InputMode |= PTYIMODE_ECHO; _SysIOCtl(0, PTY_IOCTL_SETMODE, &mode); } - + return strdup(ret); } -- 2.20.1