Commit c3301261 authored by Niels Möller's avatar Niels Möller
Browse files

mini-inetd: Clear O_NONBLOCK flag on accepted sockets.

parent 91890ab7
2013-06-18 Niels Mller <>
* src/testsuite/mini-inetd.c (main): Clear O_NONBLOCK flag on
accepted sockets.
* src/testsuite/tcpconnect.c: Include netinet/in.h.
(main): Set seen_remote_eof and seen_stdin_eof flags at EOF.
......@@ -291,6 +291,7 @@ main (int argc, char **argv)
if (FD_ISSET(fds[i], &wanted))
int conn;
int flags;
conn = accept(fds[i], NULL, NULL);
if (conn < 0)
......@@ -299,6 +300,16 @@ main (int argc, char **argv)
die("accept failed: %s\n", STRERROR(errno));
/* With traditional BSD behavior, the acccepted socket
inherits the O_NONBLOCK flag from the listening socket.
So clear it explicitly. */
flags = fcntl(conn, F_GETFL);
if (flags < 0)
werror("fcntl F_GETFL failed: %s\n", STRERROR(errno));
else if (fcntl(conn, F_SETFL, flags & ~O_NONBLOCK) < 0)
werror("fcntl F_SETFL failed: %s\n", STRERROR(errno));
start_service (conn, argv[1], argv + 2);
if (max_connections)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment