]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
Fix sentinel position in sample u2u server
authorGreg Hudson <ghudson@mit.edu>
Thu, 13 Jun 2013 15:06:23 +0000 (11:06 -0400)
committerGreg Hudson <ghudson@mit.edu>
Thu, 13 Jun 2013 15:06:54 +0000 (11:06 -0400)
Print "Server started" after calling listen(), or there wil be a race
where the client tries to connect before there is a listen queue and
gets ECONNREFUSED.

src/appl/user_user/server.c

index 3c844d82d55949b0f1bf0e9504767e106c091a17..dbff68e64a897199dc1d6cfee009ca7502e61e37 100644 (file)
@@ -95,14 +95,14 @@ int main(argc, argv)
             com_err("uu-server", errno, "binding socket");
             exit(3);
         }
-
-        printf("Server started\n");
-        fflush(stdout);
-
         if (listen(sock, 1) == -1) {
             com_err("uu-server", errno, "listening");
             exit(3);
         }
+
+        printf("Server started\n");
+        fflush(stdout);
+
         if ((acc = accept(sock, (struct sockaddr *)&f_inaddr, &namelen)) == -1) {
             com_err("uu-server", errno, "accepting");
             exit(3);