From: Bruno Haible Date: Thu, 20 Dec 2001 14:17:56 +0000 (+0000) Subject: Portability to SunOS4. X-Git-Tag: v0.11~154 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c0646fec32cc0a11f701dff5d41f7d4517979659;p=thirdparty%2Fgettext.git Portability to SunOS4. --- diff --git a/lib/ChangeLog b/lib/ChangeLog index 3a568db05..5115deb19 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,8 @@ +2001-12-20 Bruno Haible + + * setenv.c (__add_to_environ): Don't call realloc(NULL,...), use + malloc instead. For SunOS4. + 2001-12-17 Bruno Haible * pfnmatch.h: New file, from fileutils-4.1/lib/fnmatch.h with diff --git a/lib/setenv.c b/lib/setenv.c index dae9f403e..c35458e40 100644 --- a/lib/setenv.c +++ b/lib/setenv.c @@ -169,8 +169,10 @@ __add_to_environ (name, value, combined, replace) #endif /* We allocated this space; we can extend it. */ - new_environ = (char **) realloc (last_environ, - (size + 2) * sizeof (char *)); + new_environ = + (char **) (last_environ == NULL + ? malloc ((size + 2) * sizeof (char *)) + : realloc (last_environ, (size + 2) * sizeof (char *))); if (new_environ == NULL) { UNLOCK;