rpms/logrotate/devel logrotate-3.7.5-errorHandling.patch, 1.1, 1.2 logrotate.spec, 1.60, 1.61

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Sat Mar 31 10:56:52 UTC 2007


Author: pvrabec

Update of /cvs/dist/rpms/logrotate/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv15257

Modified Files:
	logrotate-3.7.5-errorHandling.patch logrotate.spec 
Log Message:
add error checking before running prerotate and postrotate scripts


logrotate-3.7.5-errorHandling.patch:
 logrotate.8 |   22 +++++++++++++++-------
 logrotate.c |   41 ++++++++++++++++++++++++++++++++---------
 2 files changed, 47 insertions(+), 16 deletions(-)

Index: logrotate-3.7.5-errorHandling.patch
===================================================================
RCS file: /cvs/dist/rpms/logrotate/devel/logrotate-3.7.5-errorHandling.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- logrotate-3.7.5-errorHandling.patch	29 Mar 2007 14:07:49 -0000	1.1
+++ logrotate-3.7.5-errorHandling.patch	31 Mar 2007 10:56:48 -0000	1.2
@@ -1,5 +1,5 @@
 --- logrotate-3.7.5/logrotate.c.errorHandling	2007-03-01 12:05:30.000000000 +0100
-+++ logrotate-3.7.5/logrotate.c	2007-03-29 15:55:48.000000000 +0200
++++ logrotate-3.7.5/logrotate.c	2007-03-31 12:50:33.000000000 +0200
 @@ -1043,6 +1043,8 @@
  		message(MESS_ERROR, "error running first action script "
  			"for %s\n", log->pattern);
@@ -9,7 +9,17 @@
  	    }
  	}
      }
-@@ -1074,9 +1076,16 @@
+@@ -1067,16 +1069,25 @@
+ 	    hasErrors |= logHasErrors[i];
+ 	}
+ 
+-	if (log->pre) {
++	if (log->pre
++	    && (! ( (logHasErrors[j] && !(log->flags & LOG_FLAG_SHAREDSCRIPTS))
++		   || (hasErrors && (log->flags & LOG_FLAG_SHAREDSCRIPTS)) ) )) {
+ 	    if (!numRotated) {
+ 		message(MESS_DEBUG, "not running prerotate script, "
+ 			"since no logs will be rotated\n");
  	    } else {
  		message(MESS_DEBUG, "running prerotate script\n");
  		if (runScript(log->pattern, log->pre)) {
@@ -29,7 +39,7 @@
  		    hasErrors = 1;
  		}
  	    }
-@@ -1085,7 +1094,8 @@
+@@ -1085,22 +1096,33 @@
  	for (i = j;
  	     ((log->flags & LOG_FLAG_SHAREDSCRIPTS) && i < log->numFiles)
  	     || (!(log->flags & LOG_FLAG_SHAREDSCRIPTS) && i == j); i++) {
@@ -39,7 +49,16 @@
  		logHasErrors[i] |=
  		    rotateSingleLog(log, i, state[i], rotNames[i]);
  		hasErrors |= logHasErrors[i];
-@@ -1099,8 +1109,16 @@
+ 	    }
+ 	}
+ 
+-	if (log->post) {
++	if (log->post
++	    && (! ( (logHasErrors[j] && !(log->flags & LOG_FLAG_SHAREDSCRIPTS))
++		   || (hasErrors && (log->flags & LOG_FLAG_SHAREDSCRIPTS)) ) )) {
+ 	    if (!numRotated) {
+ 		message(MESS_DEBUG, "not running postrotate script, "
+ 			"since no logs were rotated\n");
  	    } else {
  		message(MESS_DEBUG, "running postrotate script\n");
  		if (runScript(log->pattern, log->post)) {
@@ -58,7 +77,7 @@
  		    hasErrors = 1;
  		}
  	    }
-@@ -1109,7 +1127,8 @@
+@@ -1109,7 +1131,8 @@
  	for (i = j;
  	     ((log->flags & LOG_FLAG_SHAREDSCRIPTS) && i < log->numFiles)
  	     || (!(log->flags & LOG_FLAG_SHAREDSCRIPTS) && i == j); i++) {
@@ -69,7 +88,7 @@
  		    postrotateSingleLog(log, i, state[i], rotNames[i]);
  		hasErrors |= logHasErrors[i];
 --- logrotate-3.7.5/logrotate.8.errorHandling	2006-05-17 16:46:51.000000000 +0200
-+++ logrotate-3.7.5/logrotate.8	2007-03-29 15:53:53.000000000 +0200
++++ logrotate-3.7.5/logrotate.8	2007-03-31 12:37:06.000000000 +0200
 @@ -326,7 +326,8 @@
  \fBnosharedscripts\fR
  Run \fBprerotate\fR and \fBpostrotate\fR scripts for every log file which


Index: logrotate.spec
===================================================================
RCS file: /cvs/dist/rpms/logrotate/devel/logrotate.spec,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -r1.60 -r1.61
--- logrotate.spec	29 Mar 2007 14:07:49 -0000	1.60
+++ logrotate.spec	31 Mar 2007 10:56:49 -0000	1.61
@@ -1,7 +1,7 @@
 Summary: Rotates, compresses, removes and mails system log files
 Name: logrotate
 Version: 3.7.5
-Release: 2%{?dist}
+Release: 3%{?dist}
 License: GPL
 Group: System Environment/Base
 # The source for this package was pulled from cvs.
@@ -59,6 +59,9 @@
 %attr(0644, root, root) %verify(not size md5 mtime) %config(noreplace) %{_localstatedir}/lib/logrotate.status
 
 %changelog
+* Sat Mar 31 2007 Peter Vrabec <pvrabec at redhat.com> 3.7.5-3
+- add error checking before running prerotate and postrotate scripts
+
 * Thu Mar 29 2007 Peter Vrabec <pvrabec at redhat.com> 3.7.5-2
 - fix error hadnling after prerotate, postrotate, firstaction 
   script failure. (http://qa.mandriva.com/show_bug.cgi?id=29979)




More information about the fedora-cvs-commits mailing list