1
0
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:
Alasdair Kergon 2004-08-18 18:50:21 +00:00
parent 9bd40d31d7
commit cf076dd366
2 changed files with 16 additions and 3 deletions

View File

@ -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.

View File

@ -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))