mirror of
https://sourceware.org/git/glibc.git
synced 2026-01-06 11:51:29 +03:00
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.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user