summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlasdair Kergon <agk@redhat.com>2004-08-18 18:50:21 +0000
committerAlasdair Kergon <agk@redhat.com>2004-08-18 18:50:21 +0000
commitcf076dd3663e3f612dd3bde0cfe284afb4bab505 (patch)
tree11162a46520a17e6c34c7ea8056780513ac5e2f3
parent9bd40d31d7ffbd0102427904579352ee8a8512ef (diff)
downloadlvm2-cf076dd3663e3f612dd3bde0cfe284afb4bab505.tar.gz
lvm2-cf076dd3663e3f612dd3bde0cfe284afb4bab505.tar.xz
lvm2-cf076dd3663e3f612dd3bde0cfe284afb4bab505.zip
Cope with DT_UNKNOWN in sysfs.
-rw-r--r--WHATS_NEW1
-rw-r--r--lib/filters/filter-sysfs.c18
2 files changed, 16 insertions, 3 deletions
diff --git a/WHATS_NEW b/WHATS_NEW
index a9677dfb..9386f9bd 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.00.21 -
=============================
+ Cope with DT_UNKNOWN in sysfs.
Fix extents_moved metadata size comment.
Remove duplicate line in pvremove help text.
Support variable mirror region size.
diff --git a/lib/filters/filter-sysfs.c b/lib/filters/filter-sysfs.c
index a13bd29b..a37f5c28 100644
--- a/lib/filters/filter-sysfs.c
+++ b/lib/filters/filter-sysfs.c
@@ -169,6 +169,8 @@ static int _read_devs(struct dev_set *ds, const char *dir)
{
struct dirent *d;
DIR *dr;
+ unsigned char dtype;
+ struct stat info;
char path[PATH_MAX];
dev_t dev;
int r = 1;
@@ -189,19 +191,29 @@ static int _read_devs(struct dev_set *ds, const char *dir)
continue;
}
- if (d->d_type == DT_DIR) {
+ dtype = d->d_type;
+
+ if (dtype == DT_UNKNOWN) {
+ if (stat(path, &info) >= 0) {
+ if (S_ISDIR(info.st_mode))
+ dtype = DT_DIR;
+ else if (S_ISREG(info.st_mode))
+ dtype = DT_REG;
+ }
+ }
+
+ if (dtype == DT_DIR) {
if (!_read_devs(ds, path)) {
r = 0;
break;
}
}
- if ((d->d_type == DT_REG && !strcmp(d->d_name, "dev")))
+ if ((dtype == DT_REG && !strcmp(d->d_name, "dev")))
if (!_read_dev(path, &dev) || !_set_insert(ds, dev)) {
r = 0;
break;
}
-
}
if (closedir(dr))