diff --git a/contrib/win32/win32compat/inc/unistd.h b/contrib/win32/win32compat/inc/unistd.h index ac292f9..dcdb912 100644 --- a/contrib/win32/win32compat/inc/unistd.h +++ b/contrib/win32/win32compat/inc/unistd.h @@ -7,18 +7,30 @@ #define COMPAT_UNISTD_H 1 #include "w32posix.h" - -#define pipe(a) w32_pipe((a)) -#define open(a,b,...) w32_open((a), (b), __VA_ARGS__) -#define read(a,b,c) w32_read((a), (b), (c)) -#define write(a,b,c) w32_write((a), (b), (c)) +// +//#define pipe(a) w32_pipe((a)) +//#define open(a,b,...) w32_open((a), (b), __VA_ARGS__) +//#define read(a,b,c) w32_read((a), (b), (c)) +//#define write(a,b,c) w32_write((a), (b), (c)) #define isatty(a) w32_isatty((a)) -#define close(a) w32_close((a)) -#define dup(a) w32_dup((a)) -#define dup2(a,b) w32_dup2((a), (b)) +//#define close(a) w32_close((a)) +//#define dup(a) w32_dup((a)) +//#define dup2(a,b) w32_dup2((a), (b)) +// +//#define sleep(sec) Sleep(1000 * sec) +//#define alarm(a) w32_alarm((a)) -#define sleep(sec) Sleep(1000 * sec) -#define alarm(a) w32_alarm((a)) +#define pipe w32_pipe +#define open w32_open +#define read w32_read +#define write w32_write +//#define isatty w32_isatty +#define close w32_close +#define dup w32_dup +#define dup2 w32_dup2 + +#define sleep(sec) Sleep(1000 * sec) +#define alarm w32_alarm /* Compatibility header to avoid lots of #ifdefs in includes.h on Win32 */ diff --git a/contrib/win32/win32compat/w32fd.c b/contrib/win32/win32compat/w32fd.c index 61bbe56..5a58442 100644 --- a/contrib/win32/win32compat/w32fd.c +++ b/contrib/win32/win32compat/w32fd.c @@ -424,12 +424,15 @@ w32_select(int fds, w32_fd_set* readfds, w32_fd_set* writefds, w32_fd_set* excep HANDLE events[32]; int num_events = 0; int in_set_fds = 0, out_ready_fds = 0, i; - unsigned int time_milliseconds = timeout->tv_sec * 100 + timeout->tv_usec / 1000; + unsigned int time_milliseconds = 0; errno = 0; memset(&read_ready_fds, 0, sizeof(w32_fd_set)); memset(&write_ready_fds, 0, sizeof(w32_fd_set)); + if (timeout) + time_milliseconds = timeout->tv_sec * 100 + timeout->tv_usec / 1000; + if (fds > MAX_FDS) { errno = EINVAL; debug("ERROR: fds: %d", fds); @@ -445,6 +448,7 @@ w32_select(int fds, w32_fd_set* readfds, w32_fd_set* writefds, w32_fd_set* excep if (exceptfds) { errno = EOPNOTSUPP; debug("ERROR: exceptfds not supported"); + abort(); return -1; } diff --git a/packet.c b/packet.c index 889d76c..a98a4f4 100644 --- a/packet.c +++ b/packet.c @@ -1314,7 +1314,9 @@ ssh_packet_read_seqnr(struct ssh *ssh, u_char *typep, u_int32_t *seqnr_p) struct timeval timeout, start, *timeoutp = NULL; DBG(debug("packet_read()")); -#if(1)//ndef WIN32_FIXME +#if(0)//ndef WIN32_FIXME + int d = howmany(state->connection_in + 1, NFDBITS); + d = sizeof(fd_mask); setp = calloc(howmany(state->connection_in + 1, NFDBITS), sizeof(fd_mask)); #else @@ -1352,7 +1354,7 @@ ssh_packet_read_seqnr(struct ssh *ssh, u_char *typep, u_int32_t *seqnr_p) * Otherwise, wait for some data to arrive, add it to the * buffer, and try again. */ -#if(1)//ndef WIN32_FIXME +#if(0)//ndef WIN32_FIXME memset(setp, 0, howmany(state->connection_in + 1, NFDBITS) * sizeof(fd_mask)); #else