diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2020-11-10 12:25:55 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2020-11-10 15:48:14 +0100 |
commit | 063f9f0da9d3833e677d56933182a3f8a39b6d35 (patch) | |
tree | f58477db814d55bbbd0a32cfdf274d3c1249ee54 /src/timedate/timedatectl.c | |
parent | 55c540d39fd2a7741be1c14e34a5f09302392168 (diff) | |
download | systemd-063f9f0da9d3833e677d56933182a3f8a39b6d35.tar.gz |
basic/env-util: add little helper to call setenv or unsetenv
Diffstat (limited to 'src/timedate/timedatectl.c')
-rw-r--r-- | src/timedate/timedatectl.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/timedate/timedatectl.c b/src/timedate/timedatectl.c index 455c602c30..abc792a452 100644 --- a/src/timedate/timedatectl.c +++ b/src/timedate/timedatectl.c @@ -12,6 +12,7 @@ #include "bus-locator.h" #include "bus-map-properties.h" #include "bus-print-properties.h" +#include "env-util.h" #include "format-table.h" #include "in-addr-util.h" #include "main-func.h" @@ -139,12 +140,9 @@ static int print_status_info(const StatusInfo *i) { /* Restore the $TZ */ - if (old_tz) - r = setenv("TZ", old_tz, true); - else - r = unsetenv("TZ"); + r = set_unset_env("TZ", old_tz, true); if (r < 0) - log_warning_errno(errno, "Failed to set TZ environment variable, ignoring: %m"); + log_warning_errno(r, "Failed to set TZ environment variable, ignoring: %m"); else tzset(); |