patch 8.1.0371: argument types for select() may be wrong
Problem: Argument types for select() may be wrong.
Solution: Use a configure macro. (Tobias Ulmer)
diff --git a/src/os_unix.c b/src/os_unix.c
index f330426..aee3a35 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -18,17 +18,6 @@
* changed beyond recognition.
*/
-/*
- * Some systems have a prototype for select() that has (int *) instead of
- * (fd_set *), which is wrong. This define removes that prototype. We define
- * our own prototype below.
- * Don't use it for the Mac, it causes a warning for precompiled headers.
- * TODO: use a configure check for precompiled headers?
- */
-#if !defined(__APPLE__) && !defined(__TANDEM)
-# define select select_declared_wrong
-#endif
-
#include "vim.h"
#ifdef FEAT_MZSCHEME
@@ -54,14 +43,9 @@
# endif
#endif
-/*
- * Use this prototype for select, some include files have a wrong prototype
- */
-#ifndef __TANDEM
+#ifdef __BEOS__
# undef select
-# ifdef __BEOS__
-# define select beos_select
-# endif
+# define select beos_select
#endif
#ifdef __CYGWIN__
@@ -77,10 +61,6 @@
# endif
#endif
-#if defined(HAVE_SELECT)
-extern int select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
-#endif
-
#ifdef FEAT_MOUSE_GPM
# include <gpm.h>
/* <linux/keyboard.h> contains defines conflicting with "keymap.h",
@@ -6316,7 +6296,8 @@
if (interrupted != NULL)
*interrupted = FALSE;
- ret = select(maxfd + 1, &rfds, &wfds, &efds, tvp);
+ ret = select(maxfd + 1, SELECT_TYPE_ARG234 &rfds,
+ SELECT_TYPE_ARG234 &wfds, SELECT_TYPE_ARG234 &efds, tvp);
result = ret > 0 && FD_ISSET(fd, &rfds);
if (result)
--ret;