diff options
author | 2020-10-07 08:23:55 +0000 | |
---|---|---|
committer | 2020-10-07 08:23:55 +0000 | |
commit | 9b8516b6c53db89e9e17bee74b254518fac69498 (patch) | |
tree | 2c2049edefbe3795e379f62497f46d371b1d0462 | |
parent | Add regress tests for switching from the new TLS stack to the legacy stack. (diff) | |
download | wireguard-openbsd-9b8516b6c53db89e9e17bee74b254518fac69498.tar.xz wireguard-openbsd-9b8516b6c53db89e9e17bee74b254518fac69498.zip |
Allow fnmatch(3) wildcards in update-environment, GitHub issue 2397.
-rw-r--r-- | usr.bin/tmux/environ.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/usr.bin/tmux/environ.c b/usr.bin/tmux/environ.c index 34251b4db90..36f5a821fbb 100644 --- a/usr.bin/tmux/environ.c +++ b/usr.bin/tmux/environ.c @@ -1,4 +1,4 @@ -/* $OpenBSD: environ.c,v 1.25 2020/05/16 15:40:44 nicm Exp $ */ +/* $OpenBSD: environ.c,v 1.26 2020/10/07 08:23:55 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -18,6 +18,7 @@ #include <sys/types.h> +#include <fnmatch.h> #include <stdlib.h> #include <string.h> #include <unistd.h> @@ -191,7 +192,11 @@ environ_update(struct options *oo, struct environ *src, struct environ *dst) a = options_array_first(o); while (a != NULL) { ov = options_array_item_value(a); - if ((envent = environ_find(src, ov->string)) == NULL) + RB_FOREACH(envent, environ, src) { + if (fnmatch(ov->string, envent->name, 0) == 0) + break; + } + if (envent == NULL) environ_clear(dst, ov->string); else environ_set(dst, envent->name, 0, "%s", envent->value); |