mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
Cope with DT_UNKNOWN in sysfs.
This commit is contained in:
parent
9bd40d31d7
commit
cf076dd366
@ -1,5 +1,6 @@
|
|||||||
Version 2.00.21 -
|
Version 2.00.21 -
|
||||||
=============================
|
=============================
|
||||||
|
Cope with DT_UNKNOWN in sysfs.
|
||||||
Fix extents_moved metadata size comment.
|
Fix extents_moved metadata size comment.
|
||||||
Remove duplicate line in pvremove help text.
|
Remove duplicate line in pvremove help text.
|
||||||
Support variable mirror region size.
|
Support variable mirror region size.
|
||||||
|
@ -169,6 +169,8 @@ static int _read_devs(struct dev_set *ds, const char *dir)
|
|||||||
{
|
{
|
||||||
struct dirent *d;
|
struct dirent *d;
|
||||||
DIR *dr;
|
DIR *dr;
|
||||||
|
unsigned char dtype;
|
||||||
|
struct stat info;
|
||||||
char path[PATH_MAX];
|
char path[PATH_MAX];
|
||||||
dev_t dev;
|
dev_t dev;
|
||||||
int r = 1;
|
int r = 1;
|
||||||
@ -189,19 +191,29 @@ static int _read_devs(struct dev_set *ds, const char *dir)
|
|||||||
continue;
|
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)) {
|
if (!_read_devs(ds, path)) {
|
||||||
r = 0;
|
r = 0;
|
||||||
break;
|
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)) {
|
if (!_read_dev(path, &dev) || !_set_insert(ds, dev)) {
|
||||||
r = 0;
|
r = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (closedir(dr))
|
if (closedir(dr))
|
||||||
|
Loading…
Reference in New Issue
Block a user