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>
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;
}