diff options
author | Lennart Poettering <lennart@poettering.net> | 2019-11-12 17:52:35 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2019-11-13 12:30:22 +0100 |
commit | 437f48a471f51ac9dd2697ee3b848a71b4f101df (patch) | |
tree | f05a4944d2069c33b52618eea544f9b799414730 /src/shared/calendarspec.c | |
parent | d5fc5b2f8d62ba2a79eb755272e67ff3f117c5c5 (diff) | |
download | systemd-437f48a471f51ac9dd2697ee3b848a71b4f101df.tar.gz |
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.
Diffstat (limited to 'src/shared/calendarspec.c')
-rw-r--r-- | src/shared/calendarspec.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/shared/calendarspec.c b/src/shared/calendarspec.c index aa0d6a8224..217ab3fbaf 100644 --- a/src/shared/calendarspec.c +++ b/src/shared/calendarspec.c @@ -1352,7 +1352,12 @@ int calendar_spec_next_usec(const CalendarSpec *spec, usec_t usec, usec_t *ret_n return r; } if (r == 0) { - if (setenv("TZ", spec->timezone, 1) != 0) { + char *colon_tz; + + /* tzset(3) says $TZ should be prefixed with ":" if we reference timezone files */ + colon_tz = strjoina(":", spec->timezone); + + if (setenv("TZ", colon_tz, 1) != 0) { shared->return_value = negative_errno(); _exit(EXIT_FAILURE); } |