[prev in list] [next in list] [prev in thread] [next in thread]
List: varnish-commit
Subject: [master] 565159689 Exit(2) if we get a CLI timeout.
From: Poul-Henning Kamp <phk () FreeBSD ! org>
Date: 2023-05-10 11:56:07
Message-ID: 20230510115607.16AC8101F5B () lists ! varnish-cache ! org
[Download RAW message or body]
commit 5651596898557696b2506794744d342ff99d60dc
Author: Poul-Henning Kamp <phk@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();
_______________________________________________
varnish-commit mailing list
varnish-commit@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-commit
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic