Re: git: ac52fa1f1b97 - main - sendfile tests: Fix an error check in tcp_socketpair()

From: Gleb Smirnoff <glebius_at_freebsd.org>
Date: Mon, 24 Jun 2024 20:04:59 UTC
  Mark,

On Fri, Jun 21, 2024 at 06:21:57PM +0000, Mark Johnston wrote:
M> commit ac52fa1f1b9768d281b9deed6d1158f43a8564ca
M> Author:     Mark Johnston <markj@FreeBSD.org>
M> AuthorDate: 2024-06-21 18:18:22 +0000
M> Commit:     Mark Johnston <markj@FreeBSD.org>
M> CommitDate: 2024-06-21 18:18:22 +0000
M> 
M>     sendfile tests: Fix an error check in tcp_socketpair()
M>     
M>     Fixes:  c368d3f20fc0 ("tests/sendfile: factor out tcp_socketpair()")
M>     Differential Revision:  https://reviews.freebsd.org/D45598
M> ---
M>  tests/sys/kern/sendfile_helper.c | 2 +-
M>  1 file changed, 1 insertion(+), 1 deletion(-)
M> 
M> diff --git a/tests/sys/kern/sendfile_helper.c b/tests/sys/kern/sendfile_helper.c
M> index 703b04fdea6c..6365531e312c 100644
M> --- a/tests/sys/kern/sendfile_helper.c
M> +++ b/tests/sys/kern/sendfile_helper.c
M> @@ -84,7 +84,7 @@ tcp_socketpair(int *sv)
M>  	if (fcntl(sv[0], F_SETFL, flags) == -1)
M>  		err(1, "fcntl +O_NONBLOCK");
M>  
M> -	if (connect(sv[0], (void *)&sin, sizeof(sin)) != -1 ||
M> +	if (connect(sv[0], (void *)&sin, sizeof(sin)) == -1 &&
M>  	    errno != EINPROGRESS)
M>  		err(1, "connect cs");

Sorry for not reviewing in a timely manner. Did you actually observe connect(2)
on a non-blocking TCP socket to immediately return success?

-- 
Gleb Smirnoff