From 200cbb5b4f13f23b0098512b6622d1dec349c792 Mon Sep 17 00:00:00 2001 From: Davin McCall Date: Sun, 10 Jan 2016 11:49:23 +0000 Subject: [PATCH] Fix "skip to reply packet" method. It was possible to skip over an information packet but not read any further reply, so the packet type test (rbuffer[0] == ...) would not work correctly. --- src/dinitctl.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/dinitctl.cc b/src/dinitctl.cc index 7399cb5..11db04c 100644 --- a/src/dinitctl.cc +++ b/src/dinitctl.cc @@ -60,8 +60,10 @@ static void wait_for_reply(CPBuffer &rbuffer, int fd) // Information packet; discard. fillBufferTo(&rbuffer, fd, 1); int pktlen = (unsigned char) rbuffer[1]; + + rbuffer.consume(1); // Consume one byte so we'll read one byte of the next packet fillBufferTo(&rbuffer, fd, pktlen); - rbuffer.consume(pktlen); + rbuffer.consume(pktlen - 1); } } -- 2.25.1