aboutsummaryrefslogtreecommitdiffstats
path: root/unsetenv.c
diff options
context:
space:
mode:
Diffstat (limited to 'unsetenv.c')
-rw-r--r--unsetenv.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/unsetenv.c b/unsetenv.c
new file mode 100644
index 0000000..6f7db37
--- /dev/null
+++ b/unsetenv.c
@@ -0,0 +1,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;
+}