]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
libblkid: Refuse to create a device structure for a non-existent device
authorTheodore Ts'o <tytso@mit.edu>
Sat, 18 Oct 2008 20:47:46 +0000 (16:47 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 18 Oct 2008 20:47:46 +0000 (16:47 -0400)
Fix blkid_get_dev() so it will never return a device structure if the
device file doesn't exist.

Addresses-Debian-Bug: #502541

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lib/blkid/devname.c

index f0e127cf14b43835b46c5702b261859fee4e3690..e338c950c2dbb0b9f935e06bdfa89fdf3846f201 100644 (file)
@@ -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;