summaryrefslogtreecommitdiffstats
path: root/sys-utils/hwclock.c
diff options
context:
space:
mode:
authorSami Kerola2016-08-07 08:27:21 +0200
committerSami Kerola2016-08-12 22:25:36 +0200
commit984a60965a0e3cd3253a74c77af916b05381c03d (patch)
tree8aafe4e47b256298b2ed294dbdcdc50c59c730bf /sys-utils/hwclock.c
parenttests: mark build-in paths test as optional (diff)
downloadkernel-qcow2-util-linux-984a60965a0e3cd3253a74c77af916b05381c03d.tar.gz
kernel-qcow2-util-linux-984a60965a0e3cd3253a74c77af916b05381c03d.tar.xz
kernel-qcow2-util-linux-984a60965a0e3cd3253a74c77af916b05381c03d.zip
misc: always check setenv(3) return value
At least glibc setenv(3) can fail when system runs out of memory. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'sys-utils/hwclock.c')
-rw-r--r--sys-utils/hwclock.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys-utils/hwclock.c b/sys-utils/hwclock.c
index e98c2c00f..21caeb21b 100644
--- a/sys-utils/hwclock.c
+++ b/sys-utils/hwclock.c
@@ -81,6 +81,7 @@
#include "strutils.h"
#include "hwclock.h"
#include "timeutils.h"
+#include "env.h"
#ifdef HAVE_LIBAUDIT
#include <libaudit.h>
@@ -399,7 +400,7 @@ mktime_tz(struct tm tm, const bool universal,
zone = getenv("TZ"); /* remember original time zone */
if (universal) {
/* Set timezone to UTC */
- setenv("TZ", "", TRUE);
+ xsetenv("TZ", "", TRUE);
/*
* Note: tzset() gets called implicitly by the time code,
* but only the first time. When changing the environment
@@ -434,7 +435,7 @@ mktime_tz(struct tm tm, const bool universal,
}
/* now put back the original zone. */
if (zone)
- setenv("TZ", zone, TRUE);
+ xsetenv("TZ", zone, TRUE);
else
unsetenv("TZ");
tzset();