+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
#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;