aboutsummaryrefslogtreecommitdiffstats
path: root/unsetenv.c
diff options
context:
space:
mode:
Diffstat (limited to 'unsetenv.c')
-rw-r--r--unsetenv.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/unsetenv.c b/unsetenv.c
index 1462618..82eebcb 100644
--- a/unsetenv.c
+++ b/unsetenv.c
@@ -2,23 +2,26 @@
#include "internal.h"
-int
-liberror_unsetenv(const char *name)
+void
+liberror_unsetenv_failed(const char *name)
{
const char *desc = "";
- if (!name) {
- errno = EINVAL;
+ if (!name)
desc = "Environment variable name is NULL";
- goto error;
- } else if (!unsetenv(name)) {
- return 0;
- } else if (!*name) {
+ else if (!*name)
desc = "Environment variable name is the empty string";
- } else if (errno == EINVAL) {
+ else if (errno == EINVAL)
desc = "Environment variable name contains the '=' character";
- }
-error:
- liberror_save_backtrace(NULL);
liberror_set_error_errno(desc, "setenv", errno);
+}
+
+
+int
+liberror_unsetenv(const char *name)
+{
+ if (!unsetenv(name))
+ return 0;
+ liberror_save_backtrace(NULL);
+ liberror_unsetenv_failed(name);
return -1;
}