summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbms <bms@FreeBSD.org>2004-06-22 23:58:09 +0000
committerbms <bms@FreeBSD.org>2004-06-22 23:58:09 +0000
commit00a26380d46d88d76ced8274bb50f6e150dad4cc (patch)
tree11bb37ccb16ab7e105c6e4c1a9917330d08237a0
parent4920eabfa9fedb0d460c1021b12be50898818ede (diff)
downloadFreeBSD-src-00a26380d46d88d76ced8274bb50f6e150dad4cc.zip
FreeBSD-src-00a26380d46d88d76ced8274bb50f6e150dad4cc.tar.gz
Fix an inconsistency in socket option propagation on accept(). Propagate
the SS_NBIO flag from the parent socket to the child socket during an accept() operation. The file descriptor O_NONBLOCK flag would have been propagated already by the fflag assignment, and therefore would have been inconsistent with the underlying socket's so_state member. This makes accept() more closely adhere to the API contract we effectively outline in the manual page. Note also that Linux continues to differ here; O_NONBLOCK is not propagated. The other BSDs do propagate the flag, as does Solaris. The Single UNIX Specification does not offer specific advice on this issue. PR: kern/45733 Requested by: Jayanth Vijayaraghavan Reviewed by: rwatson
-rw-r--r--sys/kern/uipc_syscalls.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c
index 30d2343..674e6fe 100644
--- a/sys/kern/uipc_syscalls.c
+++ b/sys/kern/uipc_syscalls.c
@@ -324,6 +324,7 @@ accept1(td, uap, compat)
TAILQ_REMOVE(&head->so_comp, so, so_list);
head->so_qlen--;
+ so->so_state |= (head->so_state & SS_NBIO);
so->so_qstate &= ~SQ_COMP;
so->so_head = NULL;
OpenPOWER on IntegriCloud