fix divison-by-zero in cpu statistics Resolves: #501210
This commit is contained in:
parent
e7fa779a51
commit
111aa30899
@ -1,7 +1,7 @@
|
||||
diff -up net-snmp-5.4.1/agent/mibgroup/host/hr_filesys.c.backup_patch_7 net-snmp-5.4.1/agent/mibgroup/host/hr_filesys.c
|
||||
--- net-snmp-5.4.1/agent/mibgroup/host/hr_filesys.c.backup_patch_7 2007-05-18 20:08:01.000000000 +0200
|
||||
+++ net-snmp-5.4.1/agent/mibgroup/host/hr_filesys.c 2008-07-25 12:53:28.000000000 +0200
|
||||
@@ -911,7 +911,7 @@ Get_FSIndex(char *dev)
|
||||
diff -up net-snmp-5.1.2/agent/mibgroup/host/hr_filesys.c.file_offset net-snmp-5.1.2/agent/mibgroup/host/hr_filesys.c
|
||||
--- net-snmp-5.1.2/agent/mibgroup/host/hr_filesys.c.file_offset 2004-06-19 15:34:11.000000000 +0200
|
||||
+++ net-snmp-5.1.2/agent/mibgroup/host/hr_filesys.c 2009-01-22 14:42:26.000000000 +0100
|
||||
@@ -783,7 +783,7 @@ Get_FSIndex(char *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -10,9 +10,9 @@ diff -up net-snmp-5.4.1/agent/mibgroup/host/hr_filesys.c.backup_patch_7 net-snmp
|
||||
Get_FSSize(char *dev)
|
||||
{
|
||||
struct HRFS_statfs statfs_buf;
|
||||
diff -up net-snmp-5.4.1/agent/mibgroup/host/hr_filesys.h.backup_patch_7 net-snmp-5.4.1/agent/mibgroup/host/hr_filesys.h
|
||||
--- net-snmp-5.4.1/agent/mibgroup/host/hr_filesys.h.backup_patch_7 2002-07-04 14:58:04.000000000 +0200
|
||||
+++ net-snmp-5.4.1/agent/mibgroup/host/hr_filesys.h 2008-07-25 12:53:28.000000000 +0200
|
||||
diff -up net-snmp-5.1.2/agent/mibgroup/host/hr_filesys.h.file_offset net-snmp-5.1.2/agent/mibgroup/host/hr_filesys.h
|
||||
--- net-snmp-5.1.2/agent/mibgroup/host/hr_filesys.h.file_offset 2002-07-04 14:56:35.000000000 +0200
|
||||
+++ net-snmp-5.1.2/agent/mibgroup/host/hr_filesys.h 2009-01-22 14:42:26.000000000 +0100
|
||||
@@ -12,7 +12,7 @@ extern int Get_Next_HR_FileSys(void
|
||||
extern int Check_HR_FileSys_NFS(void);
|
||||
|
||||
@ -22,27 +22,3 @@ diff -up net-snmp-5.4.1/agent/mibgroup/host/hr_filesys.h.backup_patch_7 net-snmp
|
||||
|
||||
|
||||
#endif /* _MIBGROUP_HRFSYS_H */
|
||||
diff -up net-snmp-5.4.1/agent/snmp_vars.c.backup_patch_7 net-snmp-5.4.1/agent/snmp_vars.c
|
||||
--- net-snmp-5.4.1/agent/snmp_vars.c.backup_patch_7 2006-09-15 02:48:50.000000000 +0200
|
||||
+++ net-snmp-5.4.1/agent/snmp_vars.c 2008-07-25 12:53:28.000000000 +0200
|
||||
@@ -224,7 +224,7 @@ extern netsnmp_subtree *subtrees;
|
||||
* int name_len IN - number of sub-ids in the name
|
||||
*/
|
||||
|
||||
-long long_return;
|
||||
+fsblkcnt_t long_return;
|
||||
#ifndef ibm032
|
||||
u_char return_buf[258];
|
||||
#else
|
||||
diff -up net-snmp-5.4.1/include/net-snmp/agent/snmp_vars.h.backup_patch_7 net-snmp-5.4.1/include/net-snmp/agent/snmp_vars.h
|
||||
--- net-snmp-5.4.1/include/net-snmp/agent/snmp_vars.h.backup_patch_7 2005-06-21 23:33:55.000000000 +0200
|
||||
+++ net-snmp-5.4.1/include/net-snmp/agent/snmp_vars.h 2008-07-25 12:53:28.000000000 +0200
|
||||
@@ -73,7 +73,7 @@ PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
struct nlist;
|
||||
|
||||
- extern long long_return;
|
||||
+ extern fsblkcnt_t long_return;
|
||||
extern u_char return_buf[];
|
||||
|
||||
extern oid nullOid[];
|
||||
|
21
net-snmp-5.4.2.1-proc-div0.patch
Normal file
21
net-snmp-5.4.2.1-proc-div0.patch
Normal file
@ -0,0 +1,21 @@
|
||||
501210: net-snmp SIGFPE 0x00002aaaab37744a in var_hrproc (vp=0x7fffffffbf50)
|
||||
|
||||
Author: Jan Safranek <jsafrane@redhat.com>
|
||||
Upstream as SVN rev. 17616.
|
||||
|
||||
Index: net-snmp/agent/mibgroup/host/hr_proc.c
|
||||
===================================================================
|
||||
--- net-snmp/agent/mibgroup/host/hr_proc.c (revision 17615)
|
||||
+++ net-snmp/agent/mibgroup/host/hr_proc.c (working copy)
|
||||
@@ -182,7 +182,10 @@
|
||||
return NULL;
|
||||
|
||||
long_return = (cpu->idle_ticks - cpu->history[0].idle_hist)*100;
|
||||
- long_return /= (cpu->total_ticks - cpu->history[0].total_hist);
|
||||
+ if (cpu->total_ticks > cpu->history[0].total_hist) /* avoid div. by 0 */
|
||||
+ long_return /= (cpu->total_ticks - cpu->history[0].total_hist);
|
||||
+ else
|
||||
+ long_return = 0;
|
||||
long_return = 100 - long_return;
|
||||
if (long_return < 0)
|
||||
long_return = 0;
|
@ -8,7 +8,7 @@
|
||||
Summary: A collection of SNMP protocol tools and libraries
|
||||
Name: net-snmp
|
||||
Version: %{major_ver}
|
||||
Release: 10%{?dist}
|
||||
Release: 11%{?dist}
|
||||
Epoch: 1
|
||||
|
||||
License: BSD and MIT
|
||||
@ -35,6 +35,7 @@ Patch10: net-snmp-5.4.1-shared-ip.patch
|
||||
Patch11: net-snmp-5.4.1-sensors3.patch
|
||||
Patch12: net-snmp-5.4.1-xen-crash.patch
|
||||
Patch13: net-snmp-5.4.1-libwrap.patch
|
||||
Patch14: net-snmp-5.4.2.1-proc-div0.patch
|
||||
|
||||
Requires(pre): chkconfig
|
||||
Requires(post): chkconfig
|
||||
@ -173,6 +174,7 @@ Net-SNMP toolkit library.
|
||||
%patch11 -p1 -b .sensors
|
||||
%patch12 -p1 -b .xen-crash
|
||||
%patch13 -p1 -b .libwrap
|
||||
%patch14 -p1 -b .proc-div0
|
||||
|
||||
# Do this patch with a perl hack...
|
||||
perl -pi -e "s|'\\\$install_libdir'|'%{_libdir}'|" ltmain.sh
|
||||
@ -421,6 +423,9 @@ rm -rf ${RPM_BUILD_ROOT}
|
||||
%{_datadir}/snmp/mibs
|
||||
|
||||
%changelog
|
||||
* Mon May 18 2009 Jan Safranek <jsafranek@redhat.com> 5.4.2.1-11
|
||||
- fix divison-by-zero in cpu statistics (#501210)
|
||||
|
||||
* Fri Mar 06 2009 Jesse Keating <jkeating@redhat.com> - 5.4.2.1-10
|
||||
- Rebuild for new rpm
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user