From: John Hodge (sonata) Date: Thu, 1 Aug 2013 04:00:15 +0000 (+0800) Subject: Usermode/login - Slight cleanup X-Git-Tag: rel0.15~292^2~3 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=df2b2e6922947da996079186883e852c6ede3bee;p=tpg%2Facess2.git Usermode/login - Slight cleanup --- 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); }