diff options
author | Karel Zak | 2013-11-12 12:26:13 +0100 |
---|---|---|
committer | Karel Zak | 2013-11-12 12:26:13 +0100 |
commit | 3deb67f50d513a1a74a62e8e248357e844e701a2 (patch) | |
tree | c0a4b4fd8caf64f628ddc5bf974ad97687dc6b34 /login-utils | |
parent | docs: update links to http://git.kernel.org/ web repository views (diff) | |
download | kernel-qcow2-util-linux-3deb67f50d513a1a74a62e8e248357e844e701a2.tar.gz kernel-qcow2-util-linux-3deb67f50d513a1a74a62e8e248357e844e701a2.tar.xz kernel-qcow2-util-linux-3deb67f50d513a1a74a62e8e248357e844e701a2.zip |
sulogin: use dirent->d_type when scans /dev
... it's more effective than call fstatat() for all device.
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'login-utils')
-rw-r--r-- | login-utils/sulogin-consoles.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/login-utils/sulogin-consoles.c b/login-utils/sulogin-consoles.c index 07af33a6d..6ceea6ba7 100644 --- a/login-utils/sulogin-consoles.c +++ b/login-utils/sulogin-consoles.c @@ -242,6 +242,11 @@ char* scandev(DIR *dir, dev_t comparedev) while ((dent = readdir(dir))) { char path[PATH_MAX]; struct stat st; + +#ifdef _DIRENT_HAVE_D_TYPE + if (dent->d_type != DT_UNKNOWN && dent->d_type != DT_CHR) + continue; +#endif if (fstatat(fd, dent->d_name, &st, 0) < 0) continue; if (!S_ISCHR(st.st_mode)) |