X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Fsetenv.c;h=173d95f28b4853599777e28f7d20fdb7d32cd904;hb=d94bbd1eb1fc483d72397ec5dd94f7e885e12440;hp=ee9da0d8090c02936b4f5c2a6ddc2070116a28d5;hpb=e37c1207ef427c4af2b5d16050e0e548e6384b4a;p=pspp
diff --git a/lib/setenv.c b/lib/setenv.c
index ee9da0d809..173d95f28b 100644
--- a/lib/setenv.c
+++ b/lib/setenv.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 1995-2003, 2005-2010 Free Software Foundation, Inc.
+/* Copyright (C) 1992, 1995-2003, 2005-2011 Free Software Foundation, Inc.
This file is part of the GNU C Library.
This program is free software: you can redistribute it and/or modify
@@ -15,6 +15,7 @@
along with this program. If not, see . */
#if !_LIBC
+# define _GL_USE_STDLIB_ALLOC 1
# include
#endif
@@ -147,6 +148,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;
}