Land #1198, Fix inconsistencies in accept4.c

This commit is contained in:
Brent Cook
2025-10-07 03:07:42 -05:00

View File

@@ -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);
}