diff --git a/lib/device/dev-mpath.c b/lib/device/dev-mpath.c index 3417f392f..a6896ec42 100644 --- a/lib/device/dev-mpath.c +++ b/lib/device/dev-mpath.c @@ -722,7 +722,6 @@ const char *dev_mpath_component_wwid(struct cmd_context *cmd, struct device *dev char sysbuf[PATH_MAX] = { 0 }; char *slave_name; const char *wwid = NULL; - struct stat info; DIR *dr; struct dirent *de; @@ -734,18 +733,13 @@ const char *dev_mpath_component_wwid(struct cmd_context *cmd, struct device *dev return NULL; } - if (stat(slaves_path, &info)) - return NULL; - - if (!S_ISDIR(info.st_mode)) { - log_warn("Path %s is not a directory.", slaves_path); - return NULL; - } - /* Get wwid from first component */ if (!(dr = opendir(slaves_path))) { - log_debug("Device %s has no slaves dir", dev_name(dev)); + if (errno == ENOTDIR) + log_warn("WARNING: Path %s is not a directory.", slaves_path); + else if (errno != ENOENT) + log_sys_debug("opendir", slaves_path); return NULL; } diff --git a/lib/device/filesystem.c b/lib/device/filesystem.c index 984ce94cd..fbb6cb6bd 100644 --- a/lib/device/filesystem.c +++ b/lib/device/filesystem.c @@ -45,7 +45,6 @@ static int _get_crypt_path(dev_t lv_devt, char *lv_path, char *crypt_path) char holders_path[PATH_MAX]; char *holder_name; DIR *dr; - struct stat st; struct dirent *de; int ret = 0; @@ -56,13 +55,11 @@ static int _get_crypt_path(dev_t lv_devt, char *lv_path, char *crypt_path) } /* If the crypt dev is not active, there will be no LV holder. */ - if (stat(holders_path, &st)) { - log_error("Missing %s for %s", crypt_path, lv_path); - return 0; - } - if (!(dr = opendir(holders_path))) { - log_error("Cannot open %s", holders_path); + if (errno == ENOENT) + log_error("Missing %s for %s.", crypt_path, lv_path); + else + log_error("Cannot open %s.", holders_path); return 0; }