1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-08 05:09:24 +00:00

logrotate: Support system dates back to the year 1970

backport commit bdbfea3 from logrotate upstream.

(From OE-Core rev: ae87a0967d687cf9e308b22b35facb0b38a9141a)

Signed-off-by: Zhenbo Gao <zhenbo.gao@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Zhenbo Gao
2017-06-05 15:38:04 +08:00
committed by Richard Purdie
parent 27a40d6d52
commit 5dd94a5dc4
2 changed files with 28 additions and 0 deletions
@@ -0,0 +1,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);
@@ -23,6 +23,7 @@ SRC_URI = "https://github.com/${BPN}/${BPN}/archive/r3-9-1.tar.gz \
file://act-as-mv-when-rotate.patch \
file://update-the-manual.patch \
file://disable-check-different-filesystems.patch \
file://0001-Support-system-dates-back-to-the-year-1970.patch \
"
SRC_URI[md5sum] = "8572b7c2cf9ade09a8a8e10098500fb3"