diff options
author | peter <peter@FreeBSD.org> | 1999-11-17 03:32:05 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 1999-11-17 03:32:05 +0000 |
commit | bf227e92603cc9a64762a4466805ae399af01617 (patch) | |
tree | c2a35202e8e9f590ecf06dd86aa6d3413aa5ae8e /usr.sbin | |
parent | c1eced82100afa588581ea4e05d8e672961f6bfa (diff) | |
download | FreeBSD-src-bf227e92603cc9a64762a4466805ae399af01617.zip FreeBSD-src-bf227e92603cc9a64762a4466805ae399af01617.tar.gz |
Put the listening socket into non-blocking mode before doing an
accept(2). This is a not really problem on -current as the accept race
is fixed, however it is a MFC candidate for -stable.
This could possibly be slightly more efficient and leave the listening
socket permanently in non-blocking mode, but I wasn't certain that I
could catch all the stream/wait (not nowait) mode implications.
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/inetd/inetd.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/usr.sbin/inetd/inetd.c b/usr.sbin/inetd/inetd.c index ca5fe20..dc99fa0 100644 --- a/usr.sbin/inetd/inetd.c +++ b/usr.sbin/inetd/inetd.c @@ -428,6 +428,9 @@ main(argc, argv, envp) if (debug) warnx("someone wants %s", sep->se_service); if (sep->se_accept && sep->se_socktype == SOCK_STREAM) { + i = 1; + if (ioctl(sep->se_fd, FIONBIO, &i) < 0) + syslog(LOG_ERR, "ioctl (FIONBIO, 1): %m"); ctrl = accept(sep->se_fd, (struct sockaddr *)0, (int *)0); if (debug) @@ -442,6 +445,11 @@ main(argc, argv, envp) close(ctrl); continue; } + i = 0; + if (ioctl(sep->se_fd, FIONBIO, &i) < 0) + syslog(LOG_ERR, "ioctl1(FIONBIO, 0): %m"); + if (ioctl(ctrl, FIONBIO, &i) < 0) + syslog(LOG_ERR, "ioctl2(FIONBIO, 0): %m"); if (cpmip(sep, ctrl) < 0) { close(ctrl); continue; |