about summary refs log tree commit diff
path: root/sysdeps/generic
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-01-27 07:07:07 +0000
committerUlrich Drepper <drepper@redhat.com>2001-01-27 07:07:07 +0000
commit61f9d0a356f84837e3e3af27831ec7d8070f15b7 (patch)
tree3eaa1888ecc0b91db26832062d4c6f42f05202ca /sysdeps/generic
parent69bd45bdbd422fadce2bd7a49db0f0adfb3ea9a2 (diff)
downloadglibc-61f9d0a356f84837e3e3af27831ec7d8070f15b7.tar.gz
glibc-61f9d0a356f84837e3e3af27831ec7d8070f15b7.tar.xz
glibc-61f9d0a356f84837e3e3af27831ec7d8070f15b7.zip
Update.
	* conform/data/stdlib.h-data: Account for XPG6 changes.
	* stdlib/stdlib.h (__random): Change return value type to long.
	(posix_memalign): Cleanup parameter names.
	(setenv, unsetenv): Make available for __USE_XOPEN2K.
	Change return type of unsetenv to int.
	(qecvt, qgcvt, qfcvt): Declare only if __USE_MISC.
	* sysdeps/generic/setenv.c (unsetenv): Change return type to int.
	Return -1 and set errno if parameter is invalid.
	* stdlib/random.c (__random): Change return value type to long.
Diffstat (limited to 'sysdeps/generic')
-rw-r--r--sysdeps/generic/setenv.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/sysdeps/generic/setenv.c b/sysdeps/generic/setenv.c
index b8d234929f..6f871a65c7 100644
--- a/sysdeps/generic/setenv.c
+++ b/sysdeps/generic/setenv.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 95, 96, 97, 98, 99, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1992,95,96,97,98,99,2000,2001 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -263,13 +263,21 @@ setenv (name, value, replace)
   return __add_to_environ (name, value, NULL, replace);
 }
 
-void
+int
 unsetenv (name)
      const char *name;
 {
-  const size_t len = strlen (name);
+  const size_t len;
   char **ep;
 
+  if (name == NULL || *name == '\0' || strchr (name, '=') != NULL)
+    {
+      __set_errno (EINVAL);
+      return -1;
+    }
+
+  len = strlen (name);
+
   LOCK;
 
   ep = __environ;
@@ -288,6 +296,8 @@ unsetenv (name)
       ++ep;
 
   UNLOCK;
+
+  return 0;
 }
 
 /* The `clearenv' was planned to be added to POSIX.1 but probably