Skip to content
Snippets Groups Projects
Commit c7c5c9d8 authored by Morris Jette's avatar Morris Jette
Browse files

Fix last CLANG error

Replace putenv() with setenv() to eliminate last CLANG error reported.
setenv makes its own copies of the name/value.
parent 14138707
No related branches found
No related tags found
No related merge requests found
...@@ -280,7 +280,7 @@ setenvfs(const char *fmt, ...) ...@@ -280,7 +280,7 @@ setenvfs(const char *fmt, ...)
int setenvf(char ***envp, const char *name, const char *fmt, ...) int setenvf(char ***envp, const char *name, const char *fmt, ...)
{ {
char *str = NULL, *value; char *value;
va_list ap; va_list ap;
int size, rc; int size, rc;
...@@ -301,15 +301,7 @@ int setenvf(char ***envp, const char *name, const char *fmt, ...) ...@@ -301,15 +301,7 @@ int setenvf(char ***envp, const char *name, const char *fmt, ...)
else else
rc = 1; rc = 1;
} else { } else {
/* XXX Space is allocated on the heap and will never rc = setenv(name, value, 1);
* be reclaimed.
* Also you can not use xmalloc here since some of the
* external api's like perl will crap out when they
* try to free it.
*/
str = malloc(size); /* CLANG false positive */
snprintf(str, size, "%s=%s", name, value);
rc = putenv(str);
} }
xfree(value); xfree(value);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment