mirror of
https://github.com/tmate-io/tmate.git
synced 2025-02-17 02:41:07 +01: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)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user