]> git.saurik.com Git - apple/system_cmds.git/commitdiff
system_cmds-805.220.1.tar.gz macos-10141 macos-10142 macos-10143 v805.220.1
authorApple <opensource@apple.com>
Thu, 6 Dec 2018 05:17:00 +0000 (05:17 +0000)
committerApple <opensource@apple.com>
Thu, 6 Dec 2018 05:17:00 +0000 (05:17 +0000)
login.tproj/login.c

index d82ee2a778e95c92d278ff4128b33dfa92ffb43d..e04f40433f5b43aa85d2051f3ea95dd013292221 100644 (file)
@@ -1235,12 +1235,16 @@ getloginname(void)
                err(1, "malloc()");
        do {
                (void)printf("%s", prompt);
-               for (p = nbuf; (ch = getchar()) != '\n'; ) {
-                       if (ch == EOF) {
-                               badlogin(username);
-                               bail(NO_SLEEP_EXIT, 0);
-                       }
-                       if (p < nbuf + MAXLOGNAME - 1)
+        /* rdar://43101375 login process on 2018 hardware is blocked forever waiting on new line char
+         * The carriage return char is added to the termination condition of the
+         * for loop because for some reason, '\r' is returned by getchar() on M9 hardware.
+         */
+               for (p = nbuf; (((ch = getchar()) != '\n') && (ch != '\r')); ) {
+            if (ch == EOF) {
+                badlogin(username);
+                bail(NO_SLEEP_EXIT, 0);
+            }
+            if (p < nbuf + MAXLOGNAME - 1)
                                *p++ = ch;
                }
        } while (p == nbuf);