]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
blkid: Keep cached filesystem information on EACCES and ENOENT errors
authorTheodore Ts'o <tytso@mit.edu>
Mon, 21 Apr 2008 23:22:49 +0000 (19:22 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 21 Apr 2008 23:22:49 +0000 (19:22 -0400)
When a nonprivileged user uses the blkid command, we want to keep the
cached filesystem information, and opening a device file could result
in an EACCESS or ENOENT (if an intervening directory is mode 700).  We
were previously testing for EPERM, which was really the wrong error
code to be testing against.

Addresses-Launchpad-Bug: #220275

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

index 4a5c7e77054c59fd6e91be7085a31206f8bbbfa0..496420984a98065c521208ef4604c3694dbc3fbd 100644 (file)
@@ -1227,7 +1227,12 @@ 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 != EPERM) {
+               if ((errno != EPERM) && (errno != EACCES) &&
+                   (errno != ENOENT)) {
+                       DBG(DEBUG_PROBE, 
+                           printf("blkid_verify: error %s (%d) while "
+                                  "opening %s\n", strerror(errno), errno, 
+                                  dev->bid_name));
                        blkid_free_dev(dev);
                        return NULL;
                }