diff options
author | 2017-01-25 23:50:51 +0000 | |
---|---|---|
committer | 2017-01-25 23:50:51 +0000 | |
commit | 59e634fb711a76f019e083a874b4b5858d29cd81 (patch) | |
tree | 816464d8a8c24fa62fbd0f066ecc385c40dac7a3 | |
parent | Do not try to execute this test on !m88k archs. (diff) | |
download | wireguard-openbsd-59e634fb711a76f019e083a874b4b5858d29cd81.tar.xz wireguard-openbsd-59e634fb711a76f019e083a874b4b5858d29cd81.zip |
Clear option before adding to array if no -a, reported by Michael
Nickerson.
-rw-r--r-- | usr.bin/tmux/cmd-set-option.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.bin/tmux/cmd-set-option.c b/usr.bin/tmux/cmd-set-option.c index 54422692a1f..1aaef633851 100644 --- a/usr.bin/tmux/cmd-set-option.c +++ b/usr.bin/tmux/cmd-set-option.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-set-option.c,v 1.109 2017/01/24 20:24:54 nicm Exp $ */ +/* $OpenBSD: cmd-set-option.c,v 1.110 2017/01/25 23:50:51 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -211,9 +211,11 @@ cmd_set_option_exec(struct cmd *self, struct cmdq_item *item) } if (o == NULL) o = options_empty(oo, options_table_entry(parent)); - if (idx == -1) + if (idx == -1) { + if (!append) + options_array_clear(o); options_array_assign(o, value); - else if (options_array_set(o, idx, value, append) != 0) { + } else if (options_array_set(o, idx, value, append) != 0) { cmdq_error(item, "invalid index: %s", args->argv[0]); return (CMD_RETURN_ERROR); } |