]> git.proxmox.com Git - mirror_lxcfs.git/commitdiff
sysfs: Don't incorrectly filter entries
authorStéphane Graber <stgraber@ubuntu.com>
Sun, 13 Mar 2022 03:34:15 +0000 (22:34 -0500)
committerStéphane Graber <stgraber@ubuntu.com>
Sun, 13 Mar 2022 03:34:18 +0000 (22:34 -0500)
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 <stgraber@ubuntu.com>
src/sysfs_fuse.c

index 17b93c1118e0b6d0ce76a8d273eaf2dedc533b2a..30333bd9e07077c8ad736bf95c9c7636c50e47a6 100644 (file)
@@ -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;