From 1764f66b7d1ed0e494cfa8967c78ace8728ee86c Mon Sep 17 00:00:00 2001 From: nicm Date: Thu, 19 Dec 2019 09:22:33 +0000 Subject: When adding a list with multiple commands to the queue, the next item to insert after needs to be the last one added, not the first. Reported by Jason Kim in GitHub issue 2023. --- cfg.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'cfg.c') diff --git a/cfg.c b/cfg.c index 8509ad1b..92c87225 100644 --- a/cfg.c +++ b/cfg.c @@ -185,9 +185,9 @@ load_cfg(const char *path, struct client *c, struct cmdq_item *item, int flags, new_item0 = cmdq_get_command(pr->cmdlist, NULL, NULL, 0); if (item != NULL) - cmdq_insert_after(item, new_item0); + new_item0 = cmdq_insert_after(item, new_item0); else - cmdq_append(NULL, new_item0); + new_item0 = cmdq_append(NULL, new_item0); cmd_list_free(pr->cmdlist); if (new_item != NULL) @@ -231,9 +231,9 @@ load_cfg_from_buffer(const void *buf, size_t len, const char *path, new_item0 = cmdq_get_command(pr->cmdlist, NULL, NULL, 0); if (item != NULL) - cmdq_insert_after(item, new_item0); + new_item0 = cmdq_insert_after(item, new_item0); else - cmdq_append(NULL, new_item0); + new_item0 = cmdq_append(NULL, new_item0); cmd_list_free(pr->cmdlist); if (new_item != NULL) -- cgit