tree-wide: fix how we set $TZ

According to tzset(3) we need to prefix timezone names with ":". Let's
do so hence, to avoid any ambiguities and follow documented behaviour.
This commit is contained in:
Lennart Poettering
2019-11-13 12:30:22 +01:00
committed by Zbigniew Jędrzejewski-Szmek
parent d5fc5b2f8d
commit 437f48a471
6 changed files with 23 additions and 11 deletions
+5 -1
View File
@@ -832,8 +832,12 @@ int parse_timestamp(const char *t, usec_t *usec) {
}
if (r == 0) {
bool with_tz = true;
char *colon_tz;
if (setenv("TZ", tz, 1) != 0) {
/* tzset(3) says $TZ should be prefixed with ":" if we reference timezone files */
colon_tz = strjoina(":", tz);
if (setenv("TZ", colon_tz, 1) != 0) {
shared->return_value = negative_errno();
_exit(EXIT_FAILURE);
}