From 4fe1c74b42f99b3682114e1dab1200f6ced6881f Mon Sep 17 00:00:00 2001 From: Lili Püspök Date: Wed, 6 Mar 2024 21:02:47 +0100 Subject: unix.7: EXAMPLES: server.c: End connection with END MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Client wants to send END while server already closed the connection on DOWN, so connection is broken instead of the Result = 0 in the sample on sending a single DOWN. Now, the server disconnects only on first END. After DOWN, all further processing of number stops. Patch does not handle cases of double END sending, multiple clients etc. Fixes: 15545eb6d7ae ("unix.7: Add example") Cc: Heinrich Schuchardt Signed-off-by: Lili Püspök Signed-off-by: Alejandro Colomar --- man7/unix.7 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'man7/unix.7') diff --git a/man7/unix.7 b/man7/unix.7 index 74db95fcdb..869a3d543e 100644 --- a/man7/unix.7 +++ b/man7/unix.7 @@ -1064,12 +1064,16 @@ main(void) \& if (!strncmp(buffer, "DOWN", sizeof(buffer))) { down_flag = 1; - break; + continue; } \& if (!strncmp(buffer, "END", sizeof(buffer))) { break; } +\& + if (down_flag) { + continue; + } \& /* Add received summand. */ \& -- cgit 1.2.3-korg