From: Stéphane Graber Date: Sun, 13 Mar 2022 03:34:15 +0000 (-0500) Subject: sysfs: Don't incorrectly filter entries X-Git-Tag: v6.0.0~53^2~1 X-Git-Url: https://git.proxmox.com/?p=mirror_lxcfs.git;a=commitdiff_plain;h=ece0d2bbbc39d2408d21c28b3c1b411f7f19fd62 sysfs: Don't incorrectly filter entries The filtering logic was completely skipping any entry which was 3 characters or shorter. Instead change the logic to only attempt to parse those entries longer than 3 characters. Signed-off-by: Stéphane Graber --- diff --git a/src/sysfs_fuse.c b/src/sysfs_fuse.c index 17b93c1..30333bd 100644 --- a/src/sysfs_fuse.c +++ b/src/sysfs_fuse.c @@ -314,13 +314,13 @@ static int filler_sys_devices_system_cpu(const char *path, void *buf, while ((dirent = readdir(dir))) { char *entry = dirent->d_name; - if (strlen(entry) <= 3) - continue; - entry += 3; + if (strlen(entry) > 3) { + entry += 3; - /* Don't emit entries we already filtered above. */ - if (isdigit(*entry)) - continue; + /* Don't emit entries we already filtered above. */ + if (isdigit(*entry)) + continue; + } if (dirent_fillerat(filler, dir, dirent, buf, 0) != 0) return -ENOENT;