git: 091869def9ee - main - connect: Use soconnectat() unconditionally in kern_connect()

Mark Johnston markj at FreeBSD.org
Fri Aug 27 12:48:45 UTC 2021


The branch main has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=091869def9eeb9796c3627ea95bf6cc46cf952a0

commit 091869def9eeb9796c3627ea95bf6cc46cf952a0
Author:     Mark Johnston <markj at FreeBSD.org>
AuthorDate: 2021-08-27 12:32:07 +0000
Commit:     Mark Johnston <markj at FreeBSD.org>
CommitDate: 2021-08-27 12:32:07 +0000

    connect: Use soconnectat() unconditionally in kern_connect()
    
    soconnect(...) is equivalent to soconnectat(AT_FDCWD, ...), so rely on
    this to save a branch.  No functional change intended.
    
    MFC after:      1 week
    Sponsored by:   The FreeBSD Foundation
---
 sys/kern/uipc_syscalls.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c
index 18505b54d603..3208dc0491dd 100644
--- a/sys/kern/uipc_syscalls.c
+++ b/sys/kern/uipc_syscalls.c
@@ -511,10 +511,7 @@ kern_connectat(struct thread *td, int dirfd, int fd, struct sockaddr *sa)
 	if (error != 0)
 		goto bad;
 #endif
-	if (dirfd == AT_FDCWD)
-		error = soconnect(so, sa, td);
-	else
-		error = soconnectat(dirfd, so, sa, td);
+	error = soconnectat(dirfd, so, sa, td);
 	if (error != 0)
 		goto bad;
 	if ((so->so_state & SS_NBIO) && (so->so_state & SS_ISCONNECTING)) {


More information about the dev-commits-src-all mailing list