Usermode/login - Slight cleanup
authorJohn Hodge (sonata) <[email protected]>
Thu, 1 Aug 2013 04:00:15 +0000 (12:00 +0800)
committerJohn Hodge (sonata) <[email protected]>
Thu, 1 Aug 2013 04:00:15 +0000 (12:00 +0800)
Usermode/Applications/login_src/main.c

index 4059953..86b1884 100644 (file)
@@ -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);
 }
 

UCC git Repository :: git.ucc.asn.au