summaryrefslogtreecommitdiffstats
path: root/lib/sysfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sysfs.c')
-rw-r--r--lib/sysfs.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/sysfs.c b/lib/sysfs.c
index 7455a30f7..92e7b0e13 100644
--- a/lib/sysfs.c
+++ b/lib/sysfs.c
@@ -306,9 +306,12 @@ int sysfs_is_partition_dirent(DIR *dir, struct dirent *d, const char *parent_nam
if (strlen(d->d_name) <= len)
return 0;
- /* partitions subdir name is "<parent>[:digit:]" */
- return strncmp(p, d->d_name, len) == 0
- && isdigit(*(d->d_name + len));
+ /* partitions subdir name is
+ * "<parent>[:digit:]" or "<parent>p[:digit:]"
+ */
+ return strncmp(p, d->d_name, len) == 0 &&
+ ((*(d->d_name + len) == 'p' && isdigit(*(d->d_name + len + 1)))
+ || isdigit(*(d->d_name + len)));
}
/* Cannot use /partition file, not supported on old sysfs */