]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Portability to SunOS4.
authorBruno Haible <bruno@clisp.org>
Thu, 20 Dec 2001 14:17:56 +0000 (14:17 +0000)
committerBruno Haible <bruno@clisp.org>
Sun, 21 Jun 2009 21:52:22 +0000 (23:52 +0200)
lib/ChangeLog
lib/setenv.c

index 3a568db058661d4e53583b4bdea78d9f7380b653..5115deb19ed8c97911030685038eaebd9c448d95 100644 (file)
@@ -1,3 +1,8 @@
+2001-12-20  Bruno Haible  <bruno@clisp.org>
+
+       * setenv.c (__add_to_environ): Don't call realloc(NULL,...), use
+       malloc instead. For SunOS4.
+
 2001-12-17  Bruno Haible  <bruno@clisp.org>
 
        * pfnmatch.h: New file, from fileutils-4.1/lib/fnmatch.h with
index dae9f403e47af60614bf98dac2b054be116749ce..c35458e409367dd51b3c54163b5d216e3ac89eca 100644 (file)
@@ -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;