Skip to content

Commit

Permalink
sysfs: Don't incorrectly filter entries
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
stgraber committed Mar 13, 2022
1 parent a56e836 commit ece0d2b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/sysfs_fuse.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit ece0d2b

Please sign in to comment.