From 37f996a2b22baba8cc6ee7df87f72df25de36737 Mon Sep 17 00:00:00 2001 From: Jeff Johnston Date: Thu, 25 Sep 2008 01:23:08 +0000 Subject: 2008-09-24 Pawel Veselov Fix setenv/getenv/unsetenv to be OpenGroup compliant: * libc/include/stdlib.h (unsetenv, _unsetenv_r): Redefine with integer return types. * libc/stdlib/getenv_r.c (_findenv_r): Do no special processing with names that contain equal chars. * libc/stdlib/setenv.c: Redefine _unsetenv_r as returning int. * libc/stdlib/setenv_r.c (_setenv_r): Return -1 and set errno to EINVAL if name contains an equal sign. Do not remove any equal signs from the value. (_unsetenv_r): Modified to return int. Return -1 and set EINVAL if name contains equal sign. Return -1 if no variable(s) were found and return 0 otherwise. --- newlib/libc/stdlib/setenv.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'newlib/libc/stdlib/setenv.c') diff --git a/newlib/libc/stdlib/setenv.c b/newlib/libc/stdlib/setenv.c index 746ce6781..d423678f3 100644 --- a/newlib/libc/stdlib/setenv.c +++ b/newlib/libc/stdlib/setenv.c @@ -23,7 +23,7 @@ #include #include -extern void _unsetenv_r _PARAMS ((struct _reent *, const char *)); +extern int _unsetenv_r _PARAMS ((struct _reent *, const char *)); /* * setenv -- @@ -44,11 +44,11 @@ _DEFUN (setenv, (name, value, rewrite), * unsetenv(name) -- * Delete environmental variable "name". */ -void +int _DEFUN (unsetenv, (name), _CONST char *name) { - _unsetenv_r (_REENT, name); + return _unsetenv_r (_REENT, name); } #endif /* !_REENT_ONLY */ -- cgit v1.2.3