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
This commit is contained in:
Cole Robinson
2013-01-28 23:02:04 +01:00
committed by Jasper Lievisse Adriaanse
parent 4efe3721e7
commit 37774dc02d

View File

@@ -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);