From 37774dc02db47f815d3a3da4e51d91c6d3f4bb16 Mon Sep 17 00:00:00 2001 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 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);