The author of a55b7d7 added SOCK_CLOEXEC to the xsocket() calls. This
broke the macOS build, because macOS up to and including 10.14 doesn't
have SOCK_CLOEXEC. Luckily, xsocket() already uses the fcntl(FD_CLOEXEC)
workaround by default, so the fix is just to remove the explicit
mentions of SOCK_CLOEXEC.

Fixes #132.
---
 toys/net/netcat.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
From d33480ffe5f67b6eefce4fe11c2d7203ae3bc9b3 Mon Sep 17 00:00:00 2001
From: Elliott Hughes <[email protected]>
Date: Sat, 31 Aug 2019 20:54:05 -0700
Subject: [PATCH] netcat: fix macOS build.

The author of a55b7d7 added SOCK_CLOEXEC to the xsocket() calls. This
broke the macOS build, because macOS up to and including 10.14 doesn't
have SOCK_CLOEXEC. Luckily, xsocket() already uses the fcntl(FD_CLOEXEC)
workaround by default, so the fix is just to remove the explicit
mentions of SOCK_CLOEXEC.

Fixes #132.
---
 toys/net/netcat.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/toys/net/netcat.c b/toys/net/netcat.c
index 0a235d1e..08292799 100644
--- a/toys/net/netcat.c
+++ b/toys/net/netcat.c
@@ -110,7 +110,7 @@ void netcat_main(void)
         strcpy(sockaddr.sun_path, toys.optargs[0]);
         sockaddr.sun_family = AF_UNIX;
 
-        sockfd = xsocket(AF_UNIX, type | SOCK_CLOEXEC, 0);
+        sockfd = xsocket(AF_UNIX, type, 0);
         xconnect(sockfd, (struct sockaddr*)&sockaddr, sizeof(sockaddr));
       } else {
         sockfd = xconnectany(xgetaddrinfo(toys.optargs[0], toys.optargs[1],
@@ -138,7 +138,7 @@ void netcat_main(void)
         strcpy(sockaddr.sun_path, TT.s);
         sockaddr.sun_family = AF_UNIX;
 
-        sockfd = xsocket(AF_UNIX, type | SOCK_CLOEXEC, 0);
+        sockfd = xsocket(AF_UNIX, type, 0);
         xbind(sockfd, (struct sockaddr*)&sockaddr, sizeof(sockaddr));
       } else {
         sprintf(toybuf, "%ld", TT.p);
-- 
2.23.0.187.g17f5b7556c-goog

_______________________________________________
Toybox mailing list
[email protected]
http://lists.landley.net/listinfo.cgi/toybox-landley.net

Reply via email to