[libgtop] fsusage: Fix fetching rootfs stats on Fedora 17



commit 37774dc02db47f815d3a3da4e51d91c6d3f4bb16
Author: Cole Robinson <crobinso redhat com>
Date:   Mon Jan 28 23:02:04 2013 +0100

    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

 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 1356494..b186767 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);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]