summaryrefslogtreecommitdiffstats
path: root/include/env.h
diff options
context:
space:
mode:
authorLudwig Nussel2012-06-01 14:51:18 +0200
committerKarel Zak2012-06-05 15:16:18 +0200
commite557efdeddaf0496e846b5b1079ab8c91f56419b (patch)
treee2dc790abcd4377050ecad1e1ee6a92893da8264 /include/env.h
parentsu: use ENV_PATH resp ENV_SUPATH to be consistent with login (diff)
downloadkernel-qcow2-util-linux-e557efdeddaf0496e846b5b1079ab8c91f56419b.tar.gz
kernel-qcow2-util-linux-e557efdeddaf0496e846b5b1079ab8c91f56419b.tar.xz
kernel-qcow2-util-linux-e557efdeddaf0496e846b5b1079ab8c91f56419b.zip
su: introduce xsetenv globally
Signed-off-by: Ludwig Nussel <ludwig.nussel@suse.de>
Diffstat (limited to 'include/env.h')
-rw-r--r--include/env.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/env.h b/include/env.h
index bcd0f7ead..9c6a3fd17 100644
--- a/include/env.h
+++ b/include/env.h
@@ -4,5 +4,12 @@
extern void sanitize_env (void);
extern char *safe_getenv(const char *arg);
+static inline void
+xsetenv (char const *name, char const *val, int overwrite)
+{
+ if (setenv (name, val, overwrite) != 0)
+ err (EXIT_FAILURE, _("failed to set the %s environment variable"), name);
+}
+
#endif /* UTIL_LINUX_ENV_H */