rpm/backport-Fix-changelog-parsing-affecting-caller-timezone-stat.patch
2022-08-11 16:51:35 +08:00

31 lines
916 B
Diff

From 1a7de551a74d73f01eb40cb744c1dbba5faeb651 Mon Sep 17 00:00:00 2001
From: Panu Matilainen <pmatilai@redhat.com>
Date: Mon, 30 May 2022 14:24:45 +0300
Subject: [PATCH] Fix changelog parsing affecting caller timezone state
We meddle with TZ environ which then propagates to other values through
mktime() implicitly calling tzset(), but that other data doesn't get
reset by just restoring the TZ variable. Restore initial state by explicitly
call tzset() after we're done with it.
Fixes: #1821
---
build/parseChangelog.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/build/parseChangelog.c b/build/parseChangelog.c
index 65c0952..c59786f 100644
--- a/build/parseChangelog.c
+++ b/build/parseChangelog.c
@@ -175,6 +175,7 @@ static int dateToTimet(const char * datestr, time_t * secs, int * date_words)
setenv("TZ", tz, 1);
free(tz);
}
+ tzset();
if (*secs == -1) goto exit;
--
1.8.3.1