X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/tripe/blobdiff_plain/efd6c9e3728bceaf4e355ca1c6584a35f5eb1b1b..650a6624cf72fe28e52a29a78de0f1cbfab44d7b:/peer.c diff --git a/peer.c b/peer.c index 31aa1e28..937d29f2 100644 --- a/peer.c +++ b/peer.c @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: peer.c,v 1.2 2001/02/03 22:40:29 mdw Exp $ + * $Id: peer.c,v 1.3 2001/02/04 17:10:58 mdw Exp $ * * Communication with the peer * @@ -29,6 +29,9 @@ /*----- Revision history --------------------------------------------------* * * $Log: peer.c,v $ + * Revision 1.3 2001/02/04 17:10:58 mdw + * Make file descriptors be nonblocking and close-on-exec. + * * Revision 1.2 2001/02/03 22:40:29 mdw * Put timer information into the entropy pool when packets are received * and on similar events. Reseed the generator on the interval timer. @@ -252,6 +255,7 @@ void p_init(unsigned port) sin.sin_port = htons(port); if (bind(fd, (struct sockaddr *)&sin, sizeof(sin))) die(EXIT_FAILURE, "bind failed: %s", strerror(errno)); + fdflags(fd, O_NONBLOCK, O_NONBLOCK, FD_CLOEXEC, FD_CLOEXEC); sel_initfile(&sel, &sock, fd, SEL_READ, p_read, 0); sel_addfile(&sock); T( trace(T_PEER, "peer: created socket"); )