From 543b2580c78c0f6ed12630d9e63a0420d37b8348 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sat, 20 Apr 2019 03:05:07 -0500 Subject: Add xunsetenv() for the error checking. --- lib/env.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/env.c') diff --git a/lib/env.c b/lib/env.c index 94ea0a4e..35ef688c 100644 --- a/lib/env.c +++ b/lib/env.c @@ -80,6 +80,12 @@ void xsetenv(char *name, char *val) environ[i] = new; } +void xunsetenv(char *name) +{ + if (strchr(name, '=')) error_exit("xunsetenv %s name has =", name); + xsetenv(name, 0); +} + // reset environment for a user, optionally clearing most of it void reset_env(struct passwd *p, int clear) { -- cgit v1.2.3