From: Bruno Haible Date: Wed, 9 Jun 2010 10:40:40 +0000 (+0200) Subject: Module setenv does not depend on 'malloc-posix', 'realloc-posix'. X-Git-Tag: v0.1~4093 X-Git-Url: http://erislabs.net/gitweb/?a=commitdiff_plain;h=7c59efd8bc7abb8c79ae969a65ece95e68c9be4c;hp=296be6b6babfbe14109df50aa22488dc05ccc878;p=gnulib.git Module setenv does not depend on 'malloc-posix', 'realloc-posix'. --- diff --git a/ChangeLog b/ChangeLog index edb9122d5..361016a2e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2010-06-09 Bruno Haible + + Module setenv does not depend on 'malloc-posix', 'realloc-posix'. + * lib/setenv.c (__add_to_environ): Set errno to ENOMEM when malloc or + realloc failed. + 2010-06-08 Peter Simons maint.mk: make the news-check rule more configurable diff --git a/lib/setenv.c b/lib/setenv.c index ee9da0d80..178191c61 100644 --- a/lib/setenv.c +++ b/lib/setenv.c @@ -147,6 +147,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; }