diff options
-rw-r--r-- | lib/env.c | 30 |
1 files changed, 9 insertions, 21 deletions
@@ -127,30 +127,18 @@ void addenv (const char *string, /*@null@*/const char *value) if ((newenvc & (NEWENVP_STEP - 1)) == 0) { bool update_environ; - char **__newenvp; - /* - * If the resize operation succeeds we can - * happily go on, else print a message. - */ update_environ = (environ == newenvp); - __newenvp = REALLOC(newenvp, newenvc + NEWENVP_STEP, char *); - - if (NULL != __newenvp) { - /* - * If this is our current environment, update - * environ so that it doesn't point to some - * free memory area (realloc() could move it). - */ - if (update_environ) - environ = __newenvp; - newenvp = __newenvp; - } else { - (void) fputs (_("Environment overflow\n"), log_get_logfd()); - newenvc--; - free (newenvp[newenvc]); - } + newenvp = XREALLOC(newenvp, newenvc + NEWENVP_STEP, char *); + + /* + * If this is our current environment, update + * environ so that it doesn't point to some + * free memory area (realloc() could move it). + */ + if (update_environ) + environ = newenvp; } /* |