mirror of
https://github.com/tmate-io/tmate-ssh-server.git
synced 2020-11-18 19:53:51 -08:00
Use a temporary variable for strdup of const char *.
This commit is contained in:
parent
6491274f60
commit
05f1680efa
@ -134,14 +134,14 @@ void
|
|||||||
environ_update(const char *vars, struct environ *srcenv, struct environ *dstenv)
|
environ_update(const char *vars, struct environ *srcenv, struct environ *dstenv)
|
||||||
{
|
{
|
||||||
struct environ_entry *envent;
|
struct environ_entry *envent;
|
||||||
char *var, *next;
|
char *copyvars, *var, *next;
|
||||||
|
|
||||||
vars = next = xstrdup(vars);
|
copyvars = next = xstrdup(vars);
|
||||||
while ((var = strsep(&next, " ")) != NULL) {
|
while ((var = strsep(&next, " ")) != NULL) {
|
||||||
if ((envent = environ_find(srcenv, var)) == NULL)
|
if ((envent = environ_find(srcenv, var)) == NULL)
|
||||||
environ_set(dstenv, var, NULL);
|
environ_set(dstenv, var, NULL);
|
||||||
else
|
else
|
||||||
environ_set(dstenv, envent->name, envent->value);
|
environ_set(dstenv, envent->name, envent->value);
|
||||||
}
|
}
|
||||||
xfree(vars);
|
xfree(copyvars);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user