]> git.ipfire.org Git - thirdparty/man-pages.git/commitdiff
unix.7: EXAMPLES: server.c: End connection with END
authorLili Püspök <poordirtylili@gmail.com>
Wed, 6 Mar 2024 20:02:47 +0000 (21:02 +0100)
committerAlejandro Colomar <alx@kernel.org>
Sat, 16 Mar 2024 00:11:08 +0000 (01:11 +0100)
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>
man7/unix.7

index 74db95fcdb569019b913cc4c6cbd7181250853b9..869a3d543e62232820b8424e1893ec473d2887fa 100644 (file)
@@ -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. */
 \&