diff options
author | Werner Fink | 2014-05-08 12:09:23 +0200 |
---|---|---|
committer | Karel Zak | 2014-05-13 10:38:06 +0200 |
commit | 624b204d7bdebdc5cac17d17830c397722c6dfea (patch) | |
tree | 78e0f8c2a802eab2a34fef5364cb5e28a6bbedda /login-utils | |
parent | agetty: avoid that agetty nor sulogin are fooled by a running plymouth (diff) | |
download | kernel-qcow2-util-linux-624b204d7bdebdc5cac17d17830c397722c6dfea.tar.gz kernel-qcow2-util-linux-624b204d7bdebdc5cac17d17830c397722c6dfea.tar.xz kernel-qcow2-util-linux-624b204d7bdebdc5cac17d17830c397722c6dfea.zip |
sulogin: find a suitable console device
Enable sulogin to find a suitable console device even if the first line
in /proc/consoles does not have any major and minor number.
Signed-off-by: Werner Fink <werner@suse.de>
Diffstat (limited to 'login-utils')
-rw-r--r-- | login-utils/sulogin-consoles.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/login-utils/sulogin-consoles.c b/login-utils/sulogin-consoles.c index 6ceea6ba7..817a882cf 100644 --- a/login-utils/sulogin-consoles.c +++ b/login-utils/sulogin-consoles.c @@ -324,7 +324,7 @@ static int detect_consoles_from_proc(struct list_head *consoles) char fbuf[16 + 1]; DIR *dir = NULL; FILE *fc = NULL; - int maj, min, rc = 1; + int maj, min, rc = 1, matches; DBG(dbgprint("trying /proc")); @@ -337,10 +337,12 @@ static int detect_consoles_from_proc(struct list_head *consoles) if (!dir) goto done; - while (fscanf(fc, "%*s %*s (%16[^)]) %d:%d", fbuf, &maj, &min) == 3) { + while ((matches = fscanf(fc, "%*s %*s (%16[^)]) %d:%d", fbuf, &maj, &min)) >= 1) { char *name; dev_t comparedev; + if (matches != 3) + continue; if (!strchr(fbuf, 'E')) continue; comparedev = makedev(maj, min); |