changeset 33085:d54c339550a2

Module setenv does not depend on 'malloc-posix', 'realloc-posix'.
author Bruno Haible <bruno@clisp.org>
date Wed, 09 Jun 2010 12:40:40 +0200
parents 7e6de04e6faf
children 77d25018fb02
files ChangeLog lib/setenv.c
diffstat 2 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Jun 07 15:24:21 2010 +0200
+++ b/ChangeLog	Wed Jun 09 12:40:40 2010 +0200
@@ -1,3 +1,9 @@
+2010-06-09  Bruno Haible  <bruno@clisp.org>
+
+	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  <simons@cryp.to>
 
 	maint.mk: make the news-check rule more configurable
--- a/lib/setenv.c	Mon Jun 07 15:24:21 2010 +0200
+++ b/lib/setenv.c	Wed Jun 09 12:40:40 2010 +0200
@@ -147,6 +147,9 @@
                    : 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;
         }