--- src/consoles.c +++ src/consoles.c 2014-02-07 15:33:15.786235493 +0000 @@ -313,16 +313,19 @@ console: */ if ((fc = fopen("/proc/consoles", "re"))) { char fbuf[16]; - int maj, min; + int maj, min, matches; DIR *dir; dir = opendir("/dev"); if (!dir) { fclose(fc); goto fallback; } - while ((fscanf(fc, "%*s %*s (%[^)]) %d:%d", &fbuf[0], &maj, &min) == 3)) { + while ((matches = fscanf(fc, "%*s %*s (%[^)]) %d:%d", &fbuf[0], &maj, &min)) >= 1) { char * name; + if (matches != 3) + continue; + if (!strchr(fbuf, 'E')) continue; comparedev = makedev(maj, min);