From 03446f0f938dacad7d5aa0a7bd0a337940d85d82 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Tue, 12 Feb 2013 15:43:50 -0500 Subject: [PATCH] Fix fetching rootfs stats (bz #871629) --- ...x-fetching-rootfs-stats-on-Fedora-17.patch | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 0001-fsusage-Fix-fetching-rootfs-stats-on-Fedora-17.patch diff --git a/0001-fsusage-Fix-fetching-rootfs-stats-on-Fedora-17.patch b/0001-fsusage-Fix-fetching-rootfs-stats-on-Fedora-17.patch new file mode 100644 index 0000000..c235f51 --- /dev/null +++ b/0001-fsusage-Fix-fetching-rootfs-stats-on-Fedora-17.patch @@ -0,0 +1,34 @@ +From 37774dc02db47f815d3a3da4e51d91c6d3f4bb16 Mon Sep 17 00:00:00 2001 +Message-Id: <37774dc02db47f815d3a3da4e51d91c6d3f4bb16.1360687625.git.crobinso@redhat.com> +From: Cole Robinson +Date: Mon, 28 Jan 2013 23:02:04 +0100 +Subject: [PATCH] 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/' it bails out. + +Match early on any rootfs entries and skip them. + +Fixes #685897 +--- + sysdeps/linux/fsusage.c | 4 ++++ + 1 file changed, 4 insertions(+) + +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); +-- +1.8.1 +