[logrotate] fix #723547 - fixed size directive parsing

Jan Kaluža jkaluza at fedoraproject.org
Fri Jul 22 06:21:45 UTC 2011


commit e93251a9b63790b649761478fde8038adca557d0
Author: HanzZ <hanzz.k at gmail.com>
Date:   Fri Jul 22 10:24:35 2011 +0200

    fix #723547 - fixed size directive parsing

 logrotate-3.8.0-rot-size.patch |   44 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 44 insertions(+), 0 deletions(-)
---
diff --git a/logrotate-3.8.0-rot-size.patch b/logrotate-3.8.0-rot-size.patch
new file mode 100644
index 0000000..08b78ba
--- /dev/null
+++ b/logrotate-3.8.0-rot-size.patch
@@ -0,0 +1,44 @@
+Index: trunk/config.c
+===================================================================
+--- trunk/config.c	(revision 334)
++++ trunk/config.c	(working copy)
+@@ -891,7 +891,6 @@
+ 							
+ 					if ((key = isolateValue(configFile, lineNum, opt, &start,
+ 							&buf, length)) != NULL) {
+-						free(opt);
+ 						int l = strlen(key) - 1;
+ 						if (key[l] == 'k') {
+ 							key[l] = '\0';
+@@ -903,6 +902,7 @@
+ 							key[l] = '\0';
+ 							multiplier = 1024 * 1024 * 1024;
+ 						} else if (!isdigit(key[l])) {
++							free(opt);
+ 							message(MESS_ERROR, "%s:%d unknown unit '%c'\n",
+ 								configFile, lineNum, key[l]);
+ 							if (newlog != defConfig) {
+@@ -919,6 +919,7 @@
+ 						if (*chptr) {
+ 							message(MESS_ERROR, "%s:%d bad size '%s'\n",
+ 								configFile, lineNum, key);
++							free(opt);
+ 							if (newlog != defConfig) {
+ 								state = STATE_ERROR;
+ 								continue;
+@@ -926,11 +927,13 @@
+ 								goto error;
+ 							}
+ 						}
+-						if (!strncmp(key, "size", 4)) {
++						if (!strncmp(opt, "size", 4)) {
+ 						  newlog->criterium = ROT_SIZE;
+ 						  newlog->threshhold = size;
+-						} else
++						} else {
+ 						  newlog->minsize = size;
++						}
++						free(opt);
+ 					}
+ 					else {
+ 						free(opt);


More information about the scm-commits mailing list