diff options
author | Cole Robinson <crobinso@redhat.com> | 2013-01-28 23:02:04 +0100 |
---|---|---|
committer | Jasper Lievisse Adriaanse <jasper@humppa.nl> | 2013-01-28 23:02:04 +0100 |
commit | 37774dc02db47f815d3a3da4e51d91c6d3f4bb16 (patch) | |
tree | 02c64c55e5e431568d452e54c3b9e32eb2a6d061 | |
parent | 4efe3721e73973a3c485c60f1c7416e7b5db1b04 (diff) | |
download | libgtop-37774dc02db47f815d3a3da4e51d91c6d3f4bb16.tar.gz |
fsusage: Fix fetching rootfs stats on Fedora 17
When fsusage scans mtab, it matches on the first entry, but since 'rootfs'
isn't of the expected format '/dev/<blah>' it bails out.
Match early on any rootfs entries and skip them.
Fixes #685897
-rw-r--r-- | sysdeps/linux/fsusage.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sysdeps/linux/fsusage.c b/sysdeps/linux/fsusage.c index 13564948..b1867672 100644 --- a/sysdeps/linux/fsusage.c +++ b/sysdeps/linux/fsusage.c @@ -41,6 +41,10 @@ get_device(glibtop* server, const char *mountpoint, while ((mnt = getmntent(fp))) { + /* There can be multiple root mount entries, skip the unuseful one */ + if (!strcmp(mnt->mnt_fsname, "rootfs")) + continue; + if (!strcmp(mountpoint, mnt->mnt_dir)) { if (!strncmp(mnt->mnt_fsname, "/dev/", 5)) { g_strlcpy(device, mnt->mnt_fsname + 5, device_size); |