mirror of
https://sourceware.org/git/glibc.git
synced 2025-01-09 10:50:08 +00:00
2001-08-22 Roland McGrath <roland@frob.com>
* sysdeps/generic/dl-environ.c: Include <stdlib.h> and <unistd.h>, and don't declare unsetenv or _environ directly. (unsetenv): Return int, not void. Use __environ instead of _environ.
This commit is contained in:
parent
f95ada8103
commit
e225a4442b
@ -18,11 +18,10 @@
|
||||
02111-1307 USA. */
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <ldsodefs.h>
|
||||
|
||||
extern char **_environ;
|
||||
extern void unsetenv (const char *name);
|
||||
|
||||
/* Walk through the environment of the process and return all entries
|
||||
starting with `LD_'. */
|
||||
char *
|
||||
@ -51,13 +50,13 @@ _dl_next_ld_env_entry (char ***position)
|
||||
return result;
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
unsetenv (const char *name)
|
||||
{
|
||||
const size_t len = strlen (name);
|
||||
char **ep;
|
||||
|
||||
ep = _environ;
|
||||
ep = __environ;
|
||||
while (*ep != NULL)
|
||||
if (!strncmp (*ep, name, len) && (*ep)[len] == '=')
|
||||
{
|
||||
@ -71,4 +70,6 @@ unsetenv (const char *name)
|
||||
}
|
||||
else
|
||||
++ep;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user