Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2005-12-06 01:30:03 +0300
committerChristopher Faylor <me@cgf.cx>2005-12-06 01:30:03 +0300
commite5a0cf24156069135fcbcf6519280ae3eea6267c (patch)
tree6f843276d6493becef6434f7b7adf83be689fdf1 /winsup/cygwin/environ.cc
parentb1da33a0b031088846a1fb6417f73c4a8cd35853 (diff)
* include/cygwin/stdlib.h: New file.
* environ.cc (unsetenv): Change to return -1 on input error. * include/cygwin/version.h: Add more description to latest api bump.
Diffstat (limited to 'winsup/cygwin/environ.cc')
-rw-r--r--winsup/cygwin/environ.cc10
1 files changed, 9 insertions, 1 deletions
diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc
index e7bd292c7..af950dd05 100644
--- a/winsup/cygwin/environ.cc
+++ b/winsup/cygwin/environ.cc
@@ -362,17 +362,25 @@ setenv (const char *name, const char *value, int overwrite)
}
/* unsetenv(name) -- Delete environment variable "name". */
-extern "C" void
+extern "C" int
unsetenv (const char *name)
{
register char **e;
int offset;
+ myfault efault;
+ if (efault.faulted () || *name == '\0' || strchr (name, '='))
+ {
+ set_errno (EINVAL);
+ return -1;
+ }
while (my_findenv (name, &offset)) /* if set multiple times */
/* Move up the rest of the array */
for (e = cur_environ () + offset; ; e++)
if (!(*e = *(e + 1)))
break;
+
+ return 0;
}
/* Turn environment variable part of a=b string into uppercase. */