summaryrefslogtreecommitdiff
path: root/src/timedate
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2020-11-10 12:25:55 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2020-11-10 15:48:14 +0100
commit063f9f0da9d3833e677d56933182a3f8a39b6d35 (patch)
treef58477db814d55bbbd0a32cfdf274d3c1249ee54 /src/timedate
parent55c540d39fd2a7741be1c14e34a5f09302392168 (diff)
downloadsystemd-063f9f0da9d3833e677d56933182a3f8a39b6d35.tar.gz
basic/env-util: add little helper to call setenv or unsetenv
Diffstat (limited to 'src/timedate')
-rw-r--r--src/timedate/timedatectl.c8
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();