From b5b25b5904027a589010ab4cfbddac042ac01eb4 Mon Sep 17 00:00:00 2001 From: Tatsuya Kinoshita Date: Tue, 29 Mar 2016 01:31:04 +0900 Subject: Fix uninitialized variable when not HAVE_PUTENV --- local.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/local.c b/local.c index 202e9c4..46ac579 100644 --- a/local.c +++ b/local.c @@ -213,18 +213,17 @@ set_environ(char *var, char *value) if (var != NULL && value != NULL) setenv(var, value, 1); #else /* not HAVE_SETENV */ -#ifdef HAVE_PUTENV static Hash_sv *env_hash = NULL; Str tmp = Strnew_m_charp(var, "=", value, NULL); if (env_hash == NULL) env_hash = newHash_sv(20); putHash_sv(env_hash, var, (void *)tmp->ptr); +#ifdef HAVE_PUTENV putenv(tmp->ptr); #else /* not HAVE_PUTENV */ extern char **environ; char **ne; - char *p; int i, l, el; char **e, **newenv; @@ -251,7 +250,7 @@ set_environ(char *var, char *value) if (newenv == NULL) return; for (e = environ, ne = newenv; *e != NULL; *(ne++) = *(e++)) ; - *(ne++) = p; + *(ne++) = tmp->ptr; *ne = NULL; environ = newenv; #endif /* not HAVE_PUTENV */ -- cgit v1.2.3