forked from jengelh/util-linux
OBS-URL: https://build.opensuse.org/package/show/Base:System/util-linux?expand=0&rev=220
33 lines
951 B
Diff
33 lines
951 B
Diff
Enable sulogin to find a suitable console device even if the first line
|
|
in /proc/consoles does not have any major and minor number (bnc#862078)
|
|
|
|
---
|
|
sulogin-consoles.c | 6 ++++--
|
|
1 file changed, 4 insertions(+), 2 deletions(-)
|
|
|
|
--- login-utils/sulogin-consoles.c
|
|
+++ login-utils/sulogin-consoles.c 2014-02-07 15:47:14.246235487 +0000
|
|
@@ -319,7 +319,7 @@ static int detect_consoles_from_proc(str
|
|
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"));
|
|
|
|
@@ -332,10 +332,12 @@ static int detect_consoles_from_proc(str
|
|
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);
|