summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2017-01-25 23:50:52 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2017-01-25 23:50:52 +0000
commit8d845590c96768ea93f22023522e4063f9a5fbb0 (patch)
treeb40b60f8fa2ee5f1da91e2f5b0d98d5c73586d73 /usr.bin
parentef3145b80cc4cc511fb008520b913f278116612d (diff)
Clear option before adding to array if no -a, reported by Michael
Nickerson.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/tmux/cmd-set-option.c8
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);
}