timedatectl: when no timezone is set consider UTC the default
authorLennart Poettering <lennart@poettering.net>
Thu, 20 Aug 2015 10:16:13 +0000 (12:16 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 20 Aug 2015 10:18:26 +0000 (12:18 +0200)
This fixes #993, and ensures that the libc does not consider any
old timezone information into account, that was set earlier.

src/timedate/timedatectl.c

index 8ec6adb..1c3f03c 100644 (file)
@@ -96,7 +96,7 @@ static void print_status_info(const StatusInfo *i) {
                 old_tz = strdupa(tz);
 
         /* Set the new $TZ */
-        if (i->timezone && setenv("TZ", i->timezone, true) < 0)
+        if (setenv("TZ", isempty(i->timezone) ? "UTC" : i->timezone, true) < 0)
                 log_warning_errno(errno, "Failed to set TZ environment variable, ignoring: %m");
         else
                 tzset();