From: Theodore Ts'o Date: Mon, 8 Dec 2008 14:34:28 +0000 (+0100) Subject: blkid: Refuse to create a device structure for a non-existent device X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1de91705bd6bb477e5d371f056445b746977311e;p=util-linux 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 --- 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;