projects
/
debian
/
tar
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Imported Upstream version 1.24
[debian/tar]
/
gnu
/
setenv.c
diff --git
a/gnu/setenv.c
b/gnu/setenv.c
index d4670e5c99e8f1dffad18acc12acff60cf339833..a1c1df84ede23f97308efeca13b4f5d094a78c73 100644
(file)
--- a/
gnu/setenv.c
+++ b/
gnu/setenv.c
@@
-66,6
+66,10
@@
__libc_lock_define_initialized (static, envlock)
# define clearenv __clearenv
# define tfind __tfind
# define tsearch __tsearch
# define clearenv __clearenv
# define tfind __tfind
# define tsearch __tsearch
+#else
+/* Use the system functions, not the gnulib overrides in this file. */
+# undef malloc
+# undef realloc
#endif
/* In the GNU C library implementation we try to be more clever and
#endif
/* In the GNU C library implementation we try to be more clever and
@@
-114,8
+118,8
@@
int
__add_to_environ (const char *name, const char *value, const char *combined,
int replace)
{
__add_to_environ (const char *name, const char *value, const char *combined,
int replace)
{
-
register
char **ep;
-
register
size_t size;
+ char **ep;
+ size_t size;
const size_t namelen = strlen (name);
const size_t vallen = value != NULL ? strlen (value) + 1 : 0;
const size_t namelen = strlen (name);
const size_t vallen = value != NULL ? strlen (value) + 1 : 0;
@@
-149,6
+153,9
@@
__add_to_environ (const char *name, const char *value, const char *combined,
: realloc (last_environ, (size + 2) * sizeof (char *)));
if (new_environ == NULL)
{
: realloc (last_environ, (size + 2) * sizeof (char *)));
if (new_environ == NULL)
{
+ /* It's easier to set errno to ENOMEM than to rely on the
+ 'malloc-posix' and 'realloc-posix' gnulib modules. */
+ __set_errno (ENOMEM);
UNLOCK;
return -1;
}
UNLOCK;
return -1;
}
@@
-251,7
+258,7
@@
__add_to_environ (const char *name, const char *value, const char *combined,
if (np == NULL)
#endif
{
if (np == NULL)
#endif
{
- np = malloc (namelen + 1 + vallen);
+ np =
(char *)
malloc (namelen + 1 + vallen);
if (np == NULL)
{
#if defined USE_TSEARCH && !defined _LIBC
if (np == NULL)
{
#if defined USE_TSEARCH && !defined _LIBC