Use a temporary variable for strdup of const char *.

pull/1/head
Nicholas Marriott 2009-08-08 21:54:26 +00:00
parent 6491274f60
commit 05f1680efa
1 changed files with 3 additions and 3 deletions

View File

@ -134,14 +134,14 @@ void
environ_update(const char *vars, struct environ *srcenv, struct environ *dstenv)
{
struct environ_entry *envent;
char *var, *next;
char *copyvars, *var, *next;
vars = next = xstrdup(vars);
copyvars = next = xstrdup(vars);
while ((var = strsep(&next, " ")) != NULL) {
if ((envent = environ_find(srcenv, var)) == NULL)
environ_set(dstenv, var, NULL);
else
environ_set(dstenv, envent->name, envent->value);
}
xfree(vars);
xfree(copyvars);
}