1
0
forked from aniani/vim

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)
This commit is contained in:
Bram Moolenaar
2018-09-12 20:29:09 +02:00
parent 274cea35c6
commit 643b614087
5 changed files with 85 additions and 23 deletions

View File

@@ -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 @@ static int selinux_enabled = -1;
# 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 @@ static int selinux_enabled = -1;
# 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 @@ select_eintr:
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;