X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fsetenv.c;h=ba760d6f23d0ed87b8cd22b70b5733bff0aeac94;hb=b3c3b08eab509ef08c9303b05375088575f8cc1b;hp=ee9da0d8090c02936b4f5c2a6ddc2070116a28d5;hpb=e37c1207ef427c4af2b5d16050e0e548e6384b4a;p=gnulib.git diff --git a/lib/setenv.c b/lib/setenv.c index ee9da0d80..ba760d6f2 100644 --- a/lib/setenv.c +++ b/lib/setenv.c @@ -64,6 +64,10 @@ __libc_lock_define_initialized (static, envlock) # 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 @@ -147,6 +151,9 @@ __add_to_environ (const char *name, const char *value, const char *combined, : 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; }