X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvpp%2Fapp%2Fvppctl.c;h=31c9e43a7704d40e3df0b6c6fdb99d8c72f2e784;hb=53fffa1db7cb04982db8977acd61b808ef60d5a8;hp=f81a0ce985ad5938cd975a0a2a398e1941248585;hpb=03add7f5b5e5351790187ea6d7e83803d5be2440;p=vpp.git diff --git a/src/vpp/app/vppctl.c b/src/vpp/app/vppctl.c index f81a0ce985a..31c9e43a770 100644 --- a/src/vpp/app/vppctl.c +++ b/src/vpp/app/vppctl.c @@ -147,6 +147,7 @@ main (int argc, char *argv[]) u8 *cmd = 0; int do_quit = 0; int is_interactive = 0; + int acked = 1; /* counts messages from VPP; starts at 1 */ int sent_ttype = 0; @@ -156,7 +157,7 @@ main (int argc, char *argv[]) argc--; argv++; - if (argc > 1 && strcmp (argv[0], "-s") == 0) + if (argc > 1 && strncmp (argv[0], "-s", 2) == 0) { s->config = argv[1]; argc -= 2; @@ -179,7 +180,7 @@ main (int argc, char *argv[]) if (is_interactive) { /* Capture terminal resize events */ - memset (&sa, 0, sizeof (struct sigaction)); + clib_memset (&sa, 0, sizeof (struct sigaction)); sa.sa_handler = signal_handler_winch; if (sigaction (SIGWINCH, &sa, 0) < 0) { @@ -314,7 +315,10 @@ main (int argc, char *argv[]) } while (q < (p + len) && !*q) - q++; + { + q++; + acked++; /* every NUL is an acknowledgement */ + } len -= q - p; p = q; } @@ -322,7 +326,7 @@ main (int argc, char *argv[]) vec_reset_length (str); } - if (do_quit) + if (do_quit && do_quit < acked) { /* Ask the other end to close the connection */ clib_socket_tx_add_formatted (s, "quit\n"); @@ -339,7 +343,7 @@ main (int argc, char *argv[]) clib_socket_tx_add_formatted (s, "%s\n", cmd); clib_socket_tx (s); vec_free (cmd); - do_quit = 1; + do_quit = acked; /* quit after the next response */ } } else