From: Dr. Werner Fink Date: Tue, 26 Jul 2011 12:03:13 +0000 (+0000) Subject: Sulogin: if zero is read at reading the passwd guess it's done. X-Git-Url: https://git.wh0rd.org/?p=sysvinit.git;a=commitdiff_plain;h=e114010ad8bbd7baa9fba41ac84ea6c264f8ec88 Sulogin: if zero is read at reading the passwd guess it's done. git-svn-id: svn://svn.sv.gnu.org/sysvinit/sysvinit/trunk@108 456724a4-4300-0410-8514-c89748c515a2 --- diff --git a/doc/Changelog b/doc/Changelog index dc99219..435e624 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -30,6 +30,7 @@ sysvinit (2.89dsf) UNRELEASED; urgency=low * Make quotes visible in example of the manual page of fstab-decode * Sulogin: enforce reconnection of stdin/stdout/stderr if a device was specified. + * Sulogin: if zero is read at reading the passwd guess it's done. [ Petter Reinholdtsen ] * Next release will be 2.89dsf. diff --git a/src/sulogin.c b/src/sulogin.c index b1bd75a..70fa334 100644 --- a/src/sulogin.c +++ b/src/sulogin.c @@ -636,7 +636,7 @@ char *getpasswd(struct console *con) cp->eol = *ptr = '\0'; eightbit = ((con->flags & CON_SERIAL) == 0 || (tty.c_cflag & (PARODD|PARENB)) == 0); - while (cp->eol == 0) { + while (cp->eol == '\0') { if (read(fd, &c, 1) < 1) { if (errno == EINTR || errno == EAGAIN) { usleep(1000); @@ -669,6 +669,9 @@ char *getpasswd(struct console *con) } switch (ascval) { + case 0: + *ptr = '\0'; + goto quit; case CR: case NL: *ptr = '\0';