Blob Blame History Raw
From 24a473e10883cf61278eb8a64876ebf9e2cfbdc4 Mon Sep 17 00:00:00 2001
From: jkaluza <jkaluza@ec1272ba-9ed1-42ef-8245-99669996828e>
Date: Wed, 15 Oct 2014 13:22:23 +0000
Subject: [PATCH] Backport debian manpage and mktime patches

Upstream-commit: 9c68d75c729b926e2c70bc579a12e58e472abf57
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
 logrotate.8 | 40 ++++++++++++++++++++++------------------
 logrotate.c |  2 ++
 2 files changed, 24 insertions(+), 18 deletions(-)

diff --git a/logrotate.8 b/logrotate.8
index e48dd0b..7d93eb9 100644
--- a/logrotate.8
+++ b/logrotate.8
@@ -11,8 +11,8 @@ removal, and mailing of log files.  Each log file may be handled daily,
 weekly, monthly, or when it grows too large.
 .P
 Normally, \fBlogrotate\fR is run as a daily cron job.  It will not modify
-a log multiple times in one day unless the criterion for that log is
-based on the log's size and \fBlogrotate\fR is being run multiple times
+a log more than once in one day unless the criterion for that log is
+based on the log's size and \fBlogrotate\fR is being run more than once
 each day, or unless the \fB\-f\fR or \fB\-\-force\fR option is used.
 .P
 Any number of config files may be given on the command line. Later config
@@ -68,7 +68,7 @@ Prints a short usage message.
 
 .TP
 +\fB\-v\fR, \fB\-\-verbose\fR
-Turns on verbose mode.
+Turns on verbose mode, ie. display messages during rotation.
 
 .SH CONFIGURATION FILE
 
@@ -120,9 +120,9 @@ compress
 The first few lines set global options; in the example, logs are
 compressed after they are rotated.  Note that comments may appear
 anywhere in the config file as long as the first non-whitespace
-character on the line is a #.
+character on the line is a \fB#\fR.
 
-The next section of the config files defined how to handle the log file
+The next section of the config file defines how to handle the log file
 \fI/var/log/messages\fR. The log will go through five weekly rotations before
 being removed. After the log file has been rotated (but before the old
 version of the log has been compressed), the command 
@@ -130,14 +130,15 @@ version of the log has been compressed), the command
 
 The next section defines the parameters for both
 \fI/var/log/httpd/access.log\fR and \fI/var/log/httpd/error.log\fR.
-They are rotated whenever it grows over 100k in size, and the old logs
+Each is rotated whenever it grows over 100k in size, and the old logs
 files are mailed (uncompressed) to www@my.org after going through 5
 rotations, rather than being removed. The \fBsharedscripts\fR means that
 the \fBpostrotate\fR script will only be run once (after the old logs have 
-been compressed), not once for each log which is rotated. Note that the double
-quotes around the first filename at the beginning of this section allows
-logrotate to rotate logs with spaces in the name. Normal shell quoting rules
-apply, with ', ", and \\ characters supported.
+been compressed), not once for each log which is rotated.
+Note that log file names may be enclosed in
+quotes (and that quotes are required if the name contains spaces).
+Normal shell quoting rules apply, with \fB'\fR, \fB"\fR, and \fB\\\fR
+characters supported.
 
 The next section defines the parameters for all of the files in
 \fI/var/log/news\fR. Each file is rotated on a monthly basis.  This is
@@ -163,12 +164,12 @@ Old versions of log files are compressed with \fBgzip\fR(1) by default. See also
 .TP
 \fBcompresscmd\fR
 Specifies which command to use to compress log files.  The default is
-\fBgzip\fR.  See also \fBcompress\fR.
+\fBgzip\fR(1).  See also \fBcompress\fR.
 
 .TP
 \fBuncompresscmd\fR
 Specifies which command to use to uncompress log files.  The default is
-\fBgunzip\fR.
+\fBgunzip\fR(1).
 
 .TP
 \fBcompressext\fR
@@ -195,7 +196,7 @@ as the old log file stays in place.
 
 .TP
 \fBcopytruncate\fR
-Truncate the original log file in place after creating a copy,
+Truncate the original log file to zero size in place after creating a copy,
 instead of moving the old log file and optionally creating a new one.
 It can be used when some program cannot be told to close its logfile
 and thus might continue writing (appending) to the previous log file forever.
@@ -266,7 +267,7 @@ and thus might continue writing to the previous log file for some time.
 .TP
 \fBextension \fIext\fR
 Log files with \fIext\fR extension can keep it after the rotation. 
-If compression  is  used,  the compression extension (normally \fB.gz\fR) 
+If compression  is  used,  the compression extension (normally \fI.gz\fR) 
 appears after \fIext\fR. For example you have a logfile named mylog.foo 
 and want to rotate it to mylog.1.foo.gz instead of mylog.foo.1.gz.
 
@@ -293,7 +294,7 @@ the taboo extensions, as specified by the \fBtabooext\fR directive.
 
 .TP
 \fBmail \fIaddress\fR
-When a log is rotated out-of-existence, it is mailed to \fIaddress\fR. If
+When a log is rotated out of existence, it is mailed to \fIaddress\fR. If
 no mail should be generated by a particular log, the \fBnomail\fR directive
 may be used.
 
@@ -377,7 +378,7 @@ Do not archive  old versions of log files with date extension
 
 .TP
 \fBnomail\fR
-Don't mail old log files to any address.
+Do not mail old log files to any address.
 
 .TP
 \fBnomissingok\fR
@@ -385,7 +386,7 @@ If a log file does not exist, issue an error. This is the default.
 
 .TP
 \fBnoolddir\fR
-Logs are rotated in the same directory the log normally resides in (this 
+Logs are rotated in the directory they normally reside in (this 
 overrides the \fBolddir\fR option).
 
 .TP
@@ -515,7 +516,10 @@ number of times specified with the \fBrotate\fR directive.
 \fBsu \fIuser\fR \fIgroup\fR
 Rotate log files set under this user and group instead of using default
 user/group (usually root). \fIuser\fR specifies the user name used for
-rotation and \fIgroup\fR specifies the group used for rotation. 
+rotation and \fIgroup\fR specifies the group used for rotation. If the
+user/group you specify here does not have sufficient privilege to make 
+files with the ownership you've specified in a \fIcreate\fR instruction, 
+it will cause an error.
 
 .TP
 \fBtabooext\fR [+] \fIlist\fR
diff --git a/logrotate.c b/logrotate.c
index e056ccd..fabfde9 100644
--- a/logrotate.c
+++ b/logrotate.c
@@ -2279,12 +2279,14 @@ static int readState(char *stateFilename)
 		return 1;
 	}
 
+	memset(&st->lastRotated, 0, sizeof(st->lastRotated));
 	st->lastRotated.tm_year = year;
 	st->lastRotated.tm_mon = month;
 	st->lastRotated.tm_mday = day;
 	st->lastRotated.tm_hour = hour;
 	st->lastRotated.tm_min = minute;
 	st->lastRotated.tm_sec = second;
+	st->lastRotated.tm_isdst = -1;
 
 	/* fill in the rest of the st->lastRotated fields */
 	lr_time = mktime(&st->lastRotated);
-- 
2.14.3