[libgtop2/f18] Fix fetching rootfs stats (bz #871628)

Cole Robinson crobinso at fedoraproject.org
Tue Feb 12 22:34:31 UTC 2013


commit 3f6c6032774e0b35dc176c7fe30aa581007f980e
Author: Cole Robinson <crobinso at redhat.com>
Date:   Tue Feb 12 17:34:21 2013 -0500

    Fix fetching rootfs stats (bz #871628)

 ...ge-Fix-fetching-rootfs-stats-on-Fedora-17.patch |   34 ++++++++++++++++++++
 libgtop2.spec                                      |    8 ++++-
 2 files changed, 41 insertions(+), 1 deletions(-)
---
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 at redhat.com>
+From: Cole Robinson <crobinso at 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
+
diff --git a/libgtop2.spec b/libgtop2.spec
index 3c9c987..5e6a408 100644
--- a/libgtop2.spec
+++ b/libgtop2.spec
@@ -3,12 +3,14 @@
 Name:     libgtop2
 Summary:  LibGTop library (version 2)
 Version:  2.28.4
-Release:  3%{?dist}
+Release:  4%{?dist}
 License:  GPLv2+
 URL:      http://download.gnome.org/sources/libgtop/2.28
 Group:    System Environment/Libraries
 #VCS: git://git.gnome.org/libgtop
 Source:   http://download.gnome.org/sources/libgtop/2.28/libgtop-%{version}.tar.xz
+# Fix fetching rootfs stats (bz 871628)
+Patch1: 0001-fsusage-Fix-fetching-rootfs-stats-on-Fedora-17.patch
 BuildRequires:  glib2-devel
 BuildRequires:  gobject-introspection-devel
 BuildRequires:  libtool gettext
@@ -29,6 +31,7 @@ files to allow you to develop with LibGTop.
 
 %prep
 %setup -q -n libgtop-%{version}
+%patch1 -p1
 
 %build
 %configure --disable-gtk-doc --disable-static
@@ -64,6 +67,9 @@ find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';'
 %exclude %{_datadir}/info
 
 %changelog
+* Tue Feb 12 2013 Cole Robinson <crobinso at redhat.com> - 2.28.4-4
+- Fix fetching rootfs stats (bz #871628)
+
 * Thu Jul 19 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 2.28.4-3
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
 


More information about the scm-commits mailing list