[sysstat] - close the file descriptor in a special situation in read_uoptime function - fix the number on open

Ivana Varekova varekova at fedoraproject.org
Wed May 4 06:24:45 UTC 2011


commit 3acb6bc7f61e80cfe7c7da60ec2b1eb293bb6109
Author: Ivana Hutarova Varekova <varekova at redhat.com>
Date:   Wed May 4 08:29:58 2011 +0200

    - close the file descriptor in a special situation in read_uoptime function
    - fix the number on open files in cifsiostat output

 sysstat-10.0.0-cifs_fopen.patch |   43 +++++++++++++++++++++++++++++++++++++++
 sysstat-10.0.0-ru.patch         |   15 +++++++++++++
 sysstat.spec                    |   10 ++++++++-
 3 files changed, 67 insertions(+), 1 deletions(-)
---
diff --git a/sysstat-10.0.0-cifs_fopen.patch b/sysstat-10.0.0-cifs_fopen.patch
new file mode 100644
index 0000000..b87a56e
--- /dev/null
+++ b/sysstat-10.0.0-cifs_fopen.patch
@@ -0,0 +1,43 @@
+diff -up sysstat-10.0.0/cifsiostat.c.pom sysstat-10.0.0/cifsiostat.c
+--- sysstat-10.0.0/cifsiostat.c.pom	2011-03-11 18:09:57.000000000 +0100
++++ sysstat-10.0.0/cifsiostat.c	2011-05-04 08:09:45.000000000 +0200
+@@ -319,6 +319,8 @@ void read_cifs_stat(int curr)
+ 	char line[256];
+ 	char aux[32];
+ 	int start = 0;
++	long long unsigned aux_open;
++	long long unsigned all_open = 0;
+ 	char cifs_name[MAX_NAME_LEN];
+ 	char name_tmp[MAX_NAME_LEN];
+ 	struct cifs_stats scifs;
+@@ -337,7 +339,9 @@ void read_cifs_stat(int curr)
+ 		/* Read CIFS directory name */
+ 		if (isdigit((unsigned char) line[0]) && sscanf(line, aux , name_tmp) == 1) {
+ 			if (start) {
++				scifs.fopens = all_open;
+ 				save_stats(cifs_name, curr, &scifs);
++				all_open = 0;
+ 			}
+ 			else {
+ 				start = 1;
+@@ -353,12 +357,19 @@ void read_cifs_stat(int curr)
+ 			}
+ 			if (!strncmp(line, "Opens:", 6)) {
+ 				sscanf(line, "Opens: %llu Closes:%llu Deletes: %llu",
+-				       &scifs.fopens, &scifs.fcloses, &scifs.fdeletes);
++				       &aux_open, &scifs.fcloses, &scifs.fdeletes);
++				all_open += aux_open;
++			}
++			if (!strncmp(line, "Posix Opens:", 12)) {
++				sscanf(line, "Posix Opens: %llu Posix Mkdirs: %*llu",
++					&aux_open);
++				all_open += aux_open;
+ 			}
+ 		}
+ 	}
+ 	
+ 	if (start) {
++		scifs.fopens = all_open;
+ 		save_stats(cifs_name, curr, &scifs);
+ 	}
+ 
diff --git a/sysstat-10.0.0-ru.patch b/sysstat-10.0.0-ru.patch
new file mode 100644
index 0000000..2c9be0e
--- /dev/null
+++ b/sysstat-10.0.0-ru.patch
@@ -0,0 +1,15 @@
+diff -up sysstat-10.0.0/rd_stats.c.pom sysstat-10.0.0/rd_stats.c
+--- sysstat-10.0.0/rd_stats.c.pom	2011-03-11 18:09:57.000000000 +0100
++++ sysstat-10.0.0/rd_stats.c	2011-05-04 07:59:28.000000000 +0200
+@@ -1759,8 +1759,10 @@ void read_uptime(unsigned long long *upt
+ 	if ((fp = fopen(UPTIME, "r")) == NULL)
+ 		return;
+ 
+-	if (fgets(line, 128, fp) == NULL)
++	if (fgets(line, 128, fp) == NULL) {
++		close(fp);
+ 		return;
++	}
+ 
+ 	sscanf(line, "%lu.%lu", &up_sec, &up_cent);
+ 	*uptime = (unsigned long long) up_sec * HZ +
diff --git a/sysstat.spec b/sysstat.spec
index d153982..6d06987 100644
--- a/sysstat.spec
+++ b/sysstat.spec
@@ -1,6 +1,6 @@
 Name: sysstat
 Version: 10.0.0
-Release: 3%{?dist}
+Release: 4%{?dist}
 Summary: The sar and iostat system monitoring commands
 License: GPLv2+
 Group: Applications/System
@@ -10,6 +10,8 @@ Source: http://perso.orange.fr/sebastien.godard/%{name}-%{version}.tar.bz2
 Patch11: sysstat-10.0.0-cpu.patch
 Patch12: sysstat-10.0.0-makefile.patch
 Patch13: sysstat-10.0.0-iostat_hr.patch
+Patch14: sysstat-10.0.0-ru.patch
+Patch15: sysstat-10.0.0-cifs_fopen.patch
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 
 
 Requires: /sbin/chkconfig
@@ -29,6 +31,8 @@ activity.
 %patch11 -p1 -b .cpu
 %patch12 -p1 -b .ls
 %patch13 -p1 -b .hr
+%patch14 -p1 -b .ru
+%patch15 -p1 -b .fo
 iconv -f windows-1252 -t utf8 CREDITS > CREDITS.aux
 mv CREDITS.aux CREDITS
 
@@ -77,6 +81,10 @@ rm -rf %{buildroot}
 %{_localstatedir}/log/sa
 
 %changelog
+* Wed May  4 2011 Ivana Hutarova Varekova <varekova at redhat.com> - 10.0.0-4
+- close the file descriptor in a special situation in read_uoptime function
+- fix the number on open files in cifsiostat output
+
 * Mon May  2 2011 Ivana Hutarova Varekova <varekova at redhat.com> - 10.0.0-3
 - add -h optioon to iostat tool
   (-h   Make the disk stats report easier to read by a human.)


More information about the scm-commits mailing list