ebd67b0a1ea3e1fdf5cd5d1ef7d9e3a618c25169
hiram
  Thu Dec 19 17:46:25 2024 -0800
Mac OSX needs O_NONBLOCK instead of SOCK_NONBLOCK no redmine

diff --git src/lib/https.c src/lib/https.c
index 462175d..ece5244 100644
--- src/lib/https.c
+++ src/lib/https.c
@@ -152,31 +152,35 @@
 int bwt = 0;
 int fd = 0;
 
 while (1) 
     {
     // Do not move this to before the loop.
     /* Get underlying file descriptor, needed for select call */
     fd = BIO_get_fd(params->sbio, NULL);
     if (fd == -1) 
 	{
 	xerr("BIO doesn't seem to be initialized in https, unable to get descriptor.");
 	goto cleanup;
 	}
 
     // The earlier call to BIO_set_nbio() should have turned non-blocking io on already.
+#if defined(__APPLE__) && defined(__clang__)
+    if (fcntl(fd, F_SETFL, O_NONBLOCK) == -1)
+#else
     if (fcntl(fd, F_SETFL, SOCK_NONBLOCK) == -1)
+#endif
         {
 	xerr("Could not switch to non-blocking.\n");
 	goto cleanup;
 	}
 
     FD_ZERO(&readfds);
     FD_ZERO(&writefds);
 
     if (brd == 0)
 	FD_SET(fd, &readfds);
     if (swt < srd)
 	FD_SET(fd, &writefds);
     if (srd == 0)
 	FD_SET(params->sv[1], &readfds);