diff options
author | Lili Püspök <poordirtylili@gmail.com> | 2024-03-06 21:02:47 +0100 |
---|---|---|
committer | Alejandro Colomar <alx@kernel.org> | 2024-03-16 01:11:08 +0100 |
commit | 4fe1c74b42f99b3682114e1dab1200f6ced6881f (patch) | |
tree | 78989e3d955be2f61a07290a5d297bcc6448d95c | |
parent | e0fc7ee5e3d664c83bd0f4fc751ef80cf38ae1bc (diff) | |
download | man-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.7 | 6 |
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); |