From 2372b0fdc67f17336e39d8eb86019103aad6bb4e Mon Sep 17 00:00:00 2001 From: nicm Date: Thu, 18 Jun 2020 08:34:22 +0000 Subject: Add a flag to make a client wait for an empty line before exiting in control mode to avoid stray commands ending up in the shell. --- server-client.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'server-client.c') diff --git a/server-client.c b/server-client.c index 9e7adf55..d86a9fb8 100644 --- a/server-client.c +++ b/server-client.c @@ -2370,6 +2370,8 @@ server_client_control_flags(struct client *c, const char *next) } if (strcmp(next, "no-output") == 0) return (CLIENT_CONTROL_NOOUTPUT); + if (strcmp(next, "wait-exit") == 0) + return (CLIENT_CONTROL_WAITEXIT); return (0); } @@ -2409,6 +2411,7 @@ server_client_set_flags(struct client *c, const char *flags) control_reset_offsets(c); } free(copy); + proc_send(c->peer, MSG_FLAGS, -1, &c->flags, sizeof c->flags); } /* Get client flags. This is only flags useful to show to users. */ @@ -2427,6 +2430,8 @@ server_client_get_flags(struct client *c) strlcat(s, "ignore-size,", sizeof s); if (c->flags & CLIENT_CONTROL_NOOUTPUT) strlcat(s, "no-output,", sizeof s); + if (c->flags & CLIENT_CONTROL_WAITEXIT) + strlcat(s, "wait-exit,", sizeof s); if (c->flags & CLIENT_CONTROL_PAUSEAFTER) { xsnprintf(tmp, sizeof tmp, "pause-after=%u,", c->pause_age / 1000); -- cgit