Fix fetching rootfs stats (bz #871629)
This commit is contained in:
parent
798ee68582
commit
03446f0f93
34
0001-fsusage-Fix-fetching-rootfs-stats-on-Fedora-17.patch
Normal file
34
0001-fsusage-Fix-fetching-rootfs-stats-on-Fedora-17.patch
Normal file
@ -0,0 +1,34 @@
|
||||
From 37774dc02db47f815d3a3da4e51d91c6d3f4bb16 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <37774dc02db47f815d3a3da4e51d91c6d3f4bb16.1360687625.git.crobinso@redhat.com>
|
||||
From: Cole Robinson <crobinso@redhat.com>
|
||||
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/<blah>' 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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user