[master] 565159689 Exit(2) if we get a CLI timeout.
Poul-Henning Kamp
phk at FreeBSD.org
Wed May 10 11:56:07 UTC 2023
commit 5651596898557696b2506794744d342ff99d60dc
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Wed May 10 11:55:18 2023 +0000
Exit(2) if we get a CLI timeout.
diff --git a/bin/varnishadm/varnishadm.c b/bin/varnishadm/varnishadm.c
index e9d280f52..d08da8278 100644
--- a/bin/varnishadm/varnishadm.c
+++ b/bin/varnishadm/varnishadm.c
@@ -174,8 +174,10 @@ pass_answer(int fd, enum pass_mode_e mode)
u = VCLI_ReadResult(fd, &status, &answer, timeout);
if (u) {
- if (status == CLIS_COMMS)
- RL_EXIT(0);
+ if (status == CLIS_COMMS) {
+ fprintf(stderr, "%s\n", answer);
+ RL_EXIT(2);
+ }
if (answer)
fprintf(stderr, "%s\n", answer);
RL_EXIT(1);
@@ -304,6 +306,7 @@ interactive(int sock)
{
struct pollfd fds[2];
int i;
+ unsigned status;
line_sock = sock;
rl_already_prompted = 1;
rl_callback_handler_install("varnish> ", send_line);
@@ -324,8 +327,10 @@ interactive(int sock)
if (fds[0].revents & POLLIN) {
/* Get rid of the prompt, kinda hackish */
printf("\r \r");
- (void)pass_answer(fds[0].fd, pass_interactive);
+ status = pass_answer(fds[0].fd, pass_interactive);
rl_forced_update_display();
+ if (status == CLIS_CLOSE)
+ RL_EXIT(0);
}
if (fds[1].revents & POLLIN) {
rl_callback_read_char();
More information about the varnish-commit
mailing list