File: Check_for_timezone_changes.patch

package info (click to toggle)
cron 3.0pl1-198
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,824 kB
  • sloc: ansic: 54,879; xml: 1,600; perl: 733; sh: 495; makefile: 446; python: 43
file content (33 lines) | stat: -rw-r--r-- 1,126 bytes parent folder | download | duplicates (2)
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
28
29
30
31
32
33
From: Georges Khaznadar <georgesk@debian.org>
Date: Wed, 11 Oct 2023 11:43:22 +0200
Subject: Check_for_timezone_changes

if the timezone for a system is changed while cron is running,
and the timezone change is _not_ due to a DST event, cron is unaware of
the change and will continue using the old `GMToff` value until it is
restarted.

This patch checks for the timezone unconditionnaly

See bug #1019716: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1019716
---
 cron.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/cron.c b/cron.c
index 613e7bf..5432f21 100644
--- a/cron.c
+++ b/cron.c
@@ -371,10 +371,11 @@ set_time(int initialize)
     StartTime = time(NULL);
 
     /* We adjust the time to GMT so we can catch DST changes. */
+    /* fix for #1019716: calling get_gmtoff(&StartTime, &tm) in any case */
     tm = *localtime(&StartTime);
+    GMToff = get_gmtoff(&StartTime, &tm);
     if (initialize || tm.tm_isdst != isdst) {
        isdst = tm.tm_isdst;
-       GMToff = get_gmtoff(&StartTime, &tm);
        Debug(DSCH, ("[%d] GMToff=%ld\n",
            getpid(), (long)GMToff))
     }