netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: fix accept4() flags not work
@ 2017-01-08 10:47 yuan linyu
  2017-01-09 21:37 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: yuan linyu @ 2017-01-08 10:47 UTC (permalink / raw)
  To: netdev; +Cc: David S . Miller, yuan linyu

From: yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>

user input flags store to newsock which should be used.

Signed-off-by: yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>
---
 net/socket.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/socket.c b/net/socket.c
index a8c2307..415f988 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -1508,7 +1508,7 @@ SYSCALL_DEFINE4(accept4, int, fd, struct sockaddr __user *, upeer_sockaddr,
 	if (err)
 		goto out_fd;
 
-	err = sock->ops->accept(sock, newsock, sock->file->f_flags);
+	err = sock->ops->accept(sock, newsock, newsock->file->f_flags);
 	if (err < 0)
 		goto out_fd;
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] net: fix accept4() flags not work
  2017-01-08 10:47 [PATCH] net: fix accept4() flags not work yuan linyu
@ 2017-01-09 21:37 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-01-09 21:37 UTC (permalink / raw)
  To: cugyly; +Cc: netdev, Linyu.Yuan

From: yuan linyu <cugyly@163.com>
Date: Sun,  8 Jan 2017 18:47:30 +0800

> From: yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>
> 
> user input flags store to newsock which should be used.
> 
> Signed-off-by: yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>

It is the file flags of the parent listening socket that determines if
the accept() blocks or not.

The man page for accept() is clear about this:

	... and the socket is not marked as nonblocking

meaning the parent listening socket.

The "flags" argument of accept4() is purely for setting flags on
the accepted new child socket, it has no influence whatsoever
about the blocking of the accept() call or not.  That behavior
is determined in the context of the listening socket.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-01-09 21:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-08 10:47 [PATCH] net: fix accept4() flags not work yuan linyu
2017-01-09 21:37 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).