From 1de91705bd6bb477e5d371f056445b746977311e Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Mon, 8 Dec 2008 15:34:28 +0100 Subject: [PATCH] blkid: Refuse to create a device structure for a non-existent device Fix blkid_get_dev() so it will never return a device structure if the device file doesn't exist. [kzak@redhat.com: port from e2fsprogs to util-linux-ng tree] Addresses-Debian-Bug: #502541 Signed-off-by: "Theodore Ts'o" Signed-off-by: Karel Zak --- libs/blkid/src/devname.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libs/blkid/src/devname.c b/libs/blkid/src/devname.c index a9e01cd4..101055d8 100644 --- a/libs/blkid/src/devname.c +++ b/libs/blkid/src/devname.c @@ -65,6 +65,8 @@ blkid_dev blkid_get_dev(blkid_cache cache, const char *devname, int flags) } if (!dev && (flags & BLKID_DEV_CREATE)) { + if (access(devname, F_OK) < 0) + return NULL; dev = blkid_new_dev(); if (!dev) return NULL; -- 2.39.5