aboutsummaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended/logrotate/logrotate/0001-Support-system-dates-back-to-the-year-1970.patch
blob: b544ec6661fe8f4e0b25f84876bf6abdb0a27066 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
Support system dates back to the year 1970

The system time on Linux can be set back as far as 1970 (the epoch time).
Currently logrotate stops working correctly if the time goes before 1996.
This value (1996) appears to have been hard coded since the code was written
back in 1996. Testing and code analysis shows this can simply be modified
to 1970.

The patch is provided by Matt Bennett <matt.bennett@alliedtelesis.co.nz>

Upstream-Status: Backport +
Signed-off-by: Zhenbo Gao <zhenbo.gao@windriver.com>

diff --git a/logrotate.c.orig b/logrotate.c
index cf8bf2c..a7dadfb 100644
--- a/logrotate.c.orig
+++ b/logrotate.c
@@ -2381,7 +2381,7 @@ static int readState(char *stateFilename)
 	}
 
 	/* Hack to hide earlier bug */
-	if ((year != 1900) && (year < 1996 || year > 2100)) {
+	if ((year != 1900) && (year < 1970 || year > 2100)) {
 	    message(MESS_ERROR,
 		    "bad year %d for file %s in state file %s\n", year,
 		    argv[0], stateFilename);