aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLili Püspök <poordirtylili@gmail.com>2024-03-06 21:02:47 +0100
committerAlejandro Colomar <alx@kernel.org>2024-03-16 01:11:08 +0100
commit4fe1c74b42f99b3682114e1dab1200f6ced6881f (patch)
tree78989e3d955be2f61a07290a5d297bcc6448d95c
parente0fc7ee5e3d664c83bd0f4fc751ef80cf38ae1bc (diff)
downloadman-pages-4fe1c74b42f99b3682114e1dab1200f6ced6881f.tar.gz
unix.7: EXAMPLES: server.c: End connection with END
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 <xypron.glpk@gmx.de> Signed-off-by: Lili Püspök <poordirtylili@gmail.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
-rw-r--r--man7/unix.76
1 files changed, 5 insertions, 1 deletions
diff --git a/man7/unix.7 b/man7/unix.7
index 74db95fcdb..869a3d543e 100644
--- a/man7/unix.7
+++ b/man7/unix.7
@@ -1064,13 +1064,17 @@ 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. */
\&
result += atoi(buffer);