fix patch

This commit is contained in:
Matthias Clasen 2008-11-10 02:06:42 +00:00
parent 75244b40c3
commit ae5bb8ec3c
2 changed files with 23 additions and 17 deletions

View File

@ -7,7 +7,7 @@
Name: libgtop2
Summary: libgtop library (version 2)
Version: 2.24.0
Release: 2%{?dist}
Release: 3%{?dist}
License: GPLv2+
URL: http://download.gnome.org/sources/libgtop/2.24
Group: System Environment/Libraries
@ -42,7 +42,7 @@ files to allow you to develop with libgtop.
%prep
%setup -q -n libgtop-%{version}
%patch0 -p0 -b .read-cpuinfo-completely
%patch0 -p1 -b .read-cpuinfo-completely
%build
%configure --disable-gtk-doc --disable-static
@ -79,7 +79,7 @@ rm -rf $RPM_BUILD_ROOT
%exclude %{_datadir}/info
%changelog
* Sun Nov 9 2008 Matthias Clasen <mclasen@redhat.com> - 2.24.0-2
* Sun Nov 9 2008 Matthias Clasen <mclasen@redhat.com> - 2.24.0-3
- Read /proc/cpuinfo completely (#467455)
* Tue Sep 23 2008 Matthias Clasen <mclasen@redhat.com> - 2.24.0-1

View File

@ -1,20 +1,26 @@
Index: sysdeps/linux/sysinfo.c
===================================================================
--- sysdeps/linux/sysinfo.c (revision 2781)
+++ sysdeps/linux/sysinfo.c (working copy)
@@ -36,12 +36,12 @@
diff -up libgtop-2.24.0/sysdeps/linux/sysinfo.c.read-cpuinfo-completely libgtop-2.24.0/sysdeps/linux/sysinfo.c
--- libgtop-2.24.0/sysdeps/linux/sysinfo.c.read-cpuinfo-completely 2008-05-23 18:13:20.000000000 -0400
+++ libgtop-2.24.0/sysdeps/linux/sysinfo.c 2008-11-09 21:04:38.000000000 -0500
@@ -36,12 +36,12 @@ static glibtop_sysinfo sysinfo = { .flag
static void
init_sysinfo (glibtop *server)
{
- char buffer [16384];
+ gchar *buffer;
gchar ** processors;
- char buffer [16384];
+ gchar *buffer;
gchar ** processors;
if(G_LIKELY(sysinfo.flags)) return;
if(G_LIKELY(sysinfo.flags)) return;
- file_to_buffer(server, buffer, sizeof buffer, FILENAME);
+ if (!g_file_get_contents("/proc/cpuinfo", &buffer, NULL, NULL)) return;
- file_to_buffer(server, buffer, sizeof buffer, FILENAME);
+ if (!g_file_get_contents("/proc/cpuinfo", &buffer, NULL, NULL)) return;
/* cpuinfo records are seperated by a blank line */
processors = g_strsplit(buffer, "\n\n", 0);
/* cpuinfo records are seperated by a blank line */
processors = g_strsplit(buffer, "\n\n", 0);
@@ -87,6 +87,7 @@ init_sysinfo (glibtop *server)
}
g_strfreev(processors);
+ g_free(buffer);
sysinfo.flags = _glibtop_sysdeps_sysinfo;
}