Whamcloud - gitweb
blkid: Flush cached filesystem information on any error other than EPERM
authorTheodore Ts'o <tytso@mit.edu>
Sun, 10 Feb 2008 03:30:20 +0000 (22:30 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Sun, 10 Feb 2008 03:30:20 +0000 (22:30 -0500)
USB devices can return ENOMEDIUM, and when the filesystem cached
information wasn't flushed, it resulted in the wrong location of a
filesystem to be returned to the caller.  The only justification for
using cached information when the open fails is in the case of a
permission denied error.

Addresses-Debian-Bug: #463787

lib/blkid/probe.c

index e87c0b9..917447b 100644 (file)
@@ -1155,7 +1155,7 @@ blkid_dev blkid_verify(blkid_cache cache, blkid_dev dev)
        if (((probe.fd = open(dev->bid_name, O_RDONLY)) < 0) ||
            (fstat(probe.fd, &st) < 0)) {
                if (probe.fd >= 0) close(probe.fd);
-               if (errno == ENXIO || errno == ENODEV || errno == ENOENT) {
+               if (errno != EPERM) {
                        blkid_free_dev(dev);
                        return NULL;
                }