From 837d51be27e94c5444501f5588eba92ad2ead8c7 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Thu, 7 Jul 2016 11:39:54 +0200 Subject: [PATCH 14/15] scripts/fix-date: reject dates later than 2038 Some features may break on 32 bit systems after year 2038, and this may also be triggered by a dead battery or a misdetected RTC on some hardware. Thus let's reject dates later than 2038. There will be plenty of time before 2038 to revert this change once everything is known to work fine. --- sbin/fix-date | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sbin/fix-date b/sbin/fix-date index 02f631d..6497727 100644 --- a/sbin/fix-date +++ b/sbin/fix-date @@ -1,5 +1,7 @@ #!/bin/sh -if [ /proc/self/. -ot /usr/share/factory/version ]; then +if [ /proc/self/. -ot /usr/share/factory/version ] || + [ -x /bin/date ] && [ $(/bin/date +%Y) -gt 2038 ]; then + date=$(/bin/date) /bin/date -s "$(/bin/date -r /usr/share/factory/version)" >/dev/null 2>/dev/null msg="Replacing incorrect system date ($date) with build date ($(/bin/date))." echo "WARNING: $msg" -- 1.7.12.1