Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/pkgsrc/games/doomlegacy/patches/Attic/patch-src_mserv.c,v rcsdiff: /ftp/cvs/cvsroot/pkgsrc/games/doomlegacy/patches/Attic/patch-src_mserv.c,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.1 retrieving revision 1.2 diff -u -p -r1.1 -r1.2 --- pkgsrc/games/doomlegacy/patches/Attic/patch-src_mserv.c 2020/06/15 10:32:52 1.1 +++ pkgsrc/games/doomlegacy/patches/Attic/patch-src_mserv.c 2020/06/17 16:16:57 1.2 @@ -1,17 +1,54 @@ -$NetBSD: patch-src_mserv.c,v 1.1 2020/06/15 10:32:52 micha Exp $ +$NetBSD: patch-src_mserv.c,v 1.2 2020/06/17 16:16:57 micha Exp $ Use native inet_aton() on Solaris. +Use portable fcntl() instead of ioctl() for non-blocking mode by default. ---- src/mserv.c.orig 2020-05-10 22:05:17.000000000 +0000 +--- src/mserv.c.orig 2020-06-16 09:17:35.000000000 +0000 +++ src/mserv.c -@@ -210,7 +210,9 @@ struct Copy_CVarMS_t +@@ -122,12 +122,13 @@ + #else + # include + # ifdef __OS2__ +-# include ++# include // [MB] 2020-06-16: Maybe required for old Unix too + # endif + # include // socket(),... + # include // timeval,... (TIMEOUT) + # include // sockaddr_in + # include // inet_addr(),... ++# include // [MB] 2020-06-16: For fcntl() + # include // gethostbyname(),... + # include + # include +@@ -210,7 +211,9 @@ struct Copy_CVarMS_t #define close closesocket #endif -#if defined( WIN32) || defined( __OS2__) || defined( SOLARIS) -+// For pkgsrc: Use native inet_aton() on Solaris ++// [MB] 2020-06-16: Use native inet_aton() on Solaris +// Solaris has inet_aton() in libresolv since version 2.6 from 1997 +#if defined( WIN32) || defined( __OS2__) // || defined( SOLARIS) // it seems windows doesn't define that... maybe some other OS? OS/2 static inline int inet_aton(const char *hostname, +@@ -643,9 +646,19 @@ static int MS_Connect(char *ip_addr, cha + // winsock.h: int ioctlsocket(SOCKET,long,u_long *); + u_long test = 1; // [smite] I have no idea what this type is supposed to be + ioctlsocket(ms_socket_fd, FIONBIO, &test); +-#else ++#elif defined(__OS2__) + res = 1; // non-blocking true + ioctl(ms_socket_fd, FIONBIO, &res); ++#else ++ // [MB] 2020-06-16: Use portable POSIX way to enable non-blocking mode ++ // https://pubs.opengroup.org/onlinepubs/9699919799/functions/fcntl.html ++ res = fcntl(ms_socket_fd, F_SETFL, O_NONBLOCK); ++ if(-1 == res) ++ { ++ con_state = MSCS_FAILED; ++ MS_Close_socket(); ++ return MS_CONNECT_ERROR; ++ } + #endif + res = connect(ms_socket_fd, (struct sockaddr *) &ms_addr, sizeof(ms_addr)); + if (res < 0)