aboutsummaryrefslogtreecommitdiff
path: root/cmd-queue.c
diff options
context:
space:
mode:
Diffstat (limited to 'cmd-queue.c')
-rw-r--r--cmd-queue.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/cmd-queue.c b/cmd-queue.c
index 270ad771..f3186f2a 100644
--- a/cmd-queue.c
+++ b/cmd-queue.c
@@ -93,17 +93,16 @@ cmdq_error(struct cmd_q *cmdq, const char *fmt, ...)
struct client *c = cmdq->client;
struct cmd *cmd = cmdq->cmd;
va_list ap;
- char *msg, *cause;
+ char *msg;
size_t msglen;
va_start(ap, fmt);
msglen = xvasprintf(&msg, fmt, ap);
va_end(ap);
- if (c == NULL) {
- xasprintf(&cause, "%s:%u: %s", cmd->file, cmd->line, msg);
- ARRAY_ADD(&cfg_causes, cause);
- } else if (c->session == NULL || (c->flags & CLIENT_CONTROL)) {
+ if (c == NULL)
+ cfg_add_cause("%s:%u: %s", cmd->file, cmd->line, msg);
+ else if (c->session == NULL || (c->flags & CLIENT_CONTROL)) {
evbuffer_add(c->stderr_data, msg, msglen);
evbuffer_add(c->stderr_data, "\n", 1);
@@ -180,8 +179,6 @@ cmdq_continue(struct cmd_q *cmdq)
cmdq->cmd = TAILQ_NEXT(cmdq->cmd, qentry);
do {
- next = TAILQ_NEXT(cmdq->item, qentry);
-
while (cmdq->cmd != NULL) {
cmd_print(cmdq->cmd, s, sizeof s);
log_debug("cmdq %p: %s (client %d)", cmdq, s,
@@ -213,6 +210,7 @@ cmdq_continue(struct cmd_q *cmdq)
cmdq->cmd = TAILQ_NEXT(cmdq->cmd, qentry);
}
+ next = TAILQ_NEXT(cmdq->item, qentry);
TAILQ_REMOVE(&cmdq->queue, cmdq->item, qentry);
cmd_list_free(cmdq->item->cmdlist);