aboutsummaryrefslogtreecommitdiffstats
path: root/unsetenv.c
blob: 6f7db376f55ad31b6a60a4e2fb97e089b4024670 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/* See LICENSE file for copyright and license details. */
#include "internal.h"


int
liberror_unsetenv(const char *name)
{
	const char *desc = "";
	if (!name) {
		errno = EINVAL;
		desc = "Environment variable name is NULL";
		goto error;
	} else if (!unsetenv(name)) {
		return 0;
	} else if (!*name) {
		desc = "Environment variable name is the empty string";
	} else if (errno == EINVAL) {
		desc = "Environment variable name contains the '=' character";
	}
error:
	liberror_set_error_errno(desc, "setenv", errno);
	return -1;
}