From a041ed8cde7b67e9d6da4ada0af3826915e8dea7 Mon Sep 17 00:00:00 2001 From: Futaura Date: Sun, 7 Aug 2022 17:04:47 +0100 Subject: [PATCH] amissl: allow AmiSSL to be used with AmigaOS 4.x builds Enable AmiSSL to be used instead of static OpenSSL link libraries. for AmigaOS 4.x, as it already is in the AmigaOS 3.x build. Closes #9269 --- lib/amigaos.c | 17 ++++++++++++++++- lib/curl_setup.h | 21 ++++++++++++++++++--- 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/lib/amigaos.c b/lib/amigaos.c index d76f5b03fd..d26cd1da18 100644 --- a/lib/amigaos.c +++ b/lib/amigaos.c @@ -39,7 +39,22 @@ #include "memdebug.h" #ifdef __AMIGA__ -#if defined(HAVE_PROTO_BSDSOCKET_H) && !defined(USE_AMISSL) + +#ifdef __amigaos4__ + +#ifdef USE_AMISSL +int Curl_amiga_select(int nfds, fd_set *readfds, fd_set *writefds, + fd_set *errorfds, struct timeval *timeout) +{ + int r = WaitSelect(nfds, readfds, writefds, errorfds, timeout, 0); + /* Ensure Ctrl-C signal is actioned */ + if((r == -1) && (SOCKERRNO == EINTR)) + raise(SIGINT); + return r; +} +#endif /* USE_AMISSL */ + +#elif defined(HAVE_PROTO_BSDSOCKET_H) && !defined(USE_AMISSL) struct Library *SocketBase = NULL; extern int errno, h_errno; diff --git a/lib/curl_setup.h b/lib/curl_setup.h index 4286dcfa95..85d586180e 100644 --- a/lib/curl_setup.h +++ b/lib/curl_setup.h @@ -279,9 +279,24 @@ # include # include # include -# ifdef HAVE_PROTO_BSDSOCKET_H -# include /* ensure bsdsocket.library use */ -# define select(a,b,c,d,e) WaitSelect(a,b,c,d,e,0) +# if defined(HAVE_PROTO_BSDSOCKET_H) && \ + (!defined(__amigaos4__) || defined(USE_AMISSL)) + /* use bsdsocket.library directly, instead of libc networking functions */ +# include +# ifdef __amigaos4__ + int Curl_amiga_select(int nfds, fd_set *readfds, fd_set *writefds, + fd_set *errorfds, struct timeval *timeout); +# define select(a,b,c,d,e) Curl_amiga_select(a,b,c,d,e) +# else +# define select(a,b,c,d,e) WaitSelect(a,b,c,d,e,0) +# endif + /* must not use libc's fcntl() on bsdsocket.library sockfds! */ +# undef HAVE_FCNTL +# undef HAVE_FCNTL_O_NONBLOCK +# else + /* use libc networking and hence close() and fnctl() */ +# undef HAVE_CLOSESOCKET_CAMEL +# undef HAVE_IOCTLSOCKET_CAMEL # endif /* * In clib2 arpa/inet.h warns that some prototypes may clash -- 2.47.3