mirror of
https://github.com/masscollaborationlabs/emacs.git
synced 2025-07-04 03:13:24 +00:00
Fix the MS-Windows build
* lib-src/emacsclient.c (DEFAULT_TIMEOUT): Move out of the !WINDOWSNT condition, to fix the MS-Windows compilation. (set_socket_timeout) [WINDOWSNT]: Protect against too-large values of timeout.
This commit is contained in:
parent
a99665cf38
commit
088b81031b
1 changed files with 8 additions and 3 deletions
|
@ -55,8 +55,6 @@ char *w32_getenv (const char *);
|
|||
# include <sys/socket.h>
|
||||
# include <sys/un.h>
|
||||
|
||||
# define DEFAULT_TIMEOUT (30)
|
||||
|
||||
# define SOCKETS_IN_FILE_SYSTEM
|
||||
|
||||
# define INVALID_SOCKET (-1)
|
||||
|
@ -68,6 +66,8 @@ char *w32_getenv (const char *);
|
|||
|
||||
#endif /* !WINDOWSNT */
|
||||
|
||||
#define DEFAULT_TIMEOUT (30)
|
||||
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <getopt.h>
|
||||
|
@ -1898,7 +1898,12 @@ set_socket_timeout (HSOCKET socket, int seconds)
|
|||
timeout.tv_usec = 0;
|
||||
setsockopt (socket, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof timeout);
|
||||
#else
|
||||
DWORD timeout = seconds * 1000;
|
||||
DWORD timeout;
|
||||
|
||||
if (seconds > INT_MAX / 1000)
|
||||
timeout = INT_MAX;
|
||||
else
|
||||
timeout = seconds * 1000;
|
||||
setsockopt (socket, SOL_SOCKET, SO_RCVTIMEO, (char *) &timeout, sizeof timeout);
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue