From d7a9ca6d2ffdfd65543c32b6f11a8a106e839d81 Mon Sep 17 00:00:00 2001 From: imorgenstern Date: Thu, 28 Aug 2025 13:42:04 +0200 Subject: Fix inconsistencies in accept4.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix inconsistencies in accept4.c. If the underlying accept() fails the shim returns the listening socket s instead of −1. --- apps/nc/compat/accept4.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'apps') diff --git a/apps/nc/compat/accept4.c b/apps/nc/compat/accept4.c index 278198b..dca42e9 100644 --- a/apps/nc/compat/accept4.c +++ b/apps/nc/compat/accept4.c @@ -6,10 +6,10 @@ accept4(int s, struct sockaddr *addr, socklen_t *addrlen, int flags) { int rets = accept(s, addr, addrlen); if (rets == -1) - return s; + return rets; if (flags & SOCK_CLOEXEC) { - flags = fcntl(s, F_GETFD); + flags = fcntl(rets, F_GETFD); fcntl(rets, F_SETFD, flags | FD_CLOEXEC); } -- cgit v1.2.3-55-g6feb