This commit is contained in:
manojampalam 2016-03-06 22:48:26 -08:00
parent e4c233e95c
commit d871c325aa
3 changed files with 31 additions and 13 deletions

View File

@ -7,18 +7,30 @@
#define COMPAT_UNISTD_H 1 #define COMPAT_UNISTD_H 1
#include "w32posix.h" #include "w32posix.h"
//
#define pipe(a) w32_pipe((a)) //#define pipe(a) w32_pipe((a))
#define open(a,b,...) w32_open((a), (b), __VA_ARGS__) //#define open(a,b,...) w32_open((a), (b), __VA_ARGS__)
#define read(a,b,c) w32_read((a), (b), (c)) //#define read(a,b,c) w32_read((a), (b), (c))
#define write(a,b,c) w32_write((a), (b), (c)) //#define write(a,b,c) w32_write((a), (b), (c))
#define isatty(a) w32_isatty((a)) #define isatty(a) w32_isatty((a))
#define close(a) w32_close((a)) //#define close(a) w32_close((a))
#define dup(a) w32_dup((a)) //#define dup(a) w32_dup((a))
#define dup2(a,b) w32_dup2((a), (b)) //#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 pipe w32_pipe
#define alarm(a) w32_alarm((a)) #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 */ /* Compatibility header to avoid lots of #ifdefs in includes.h on Win32 */

View File

@ -424,12 +424,15 @@ w32_select(int fds, w32_fd_set* readfds, w32_fd_set* writefds, w32_fd_set* excep
HANDLE events[32]; HANDLE events[32];
int num_events = 0; int num_events = 0;
int in_set_fds = 0, out_ready_fds = 0, i; 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; errno = 0;
memset(&read_ready_fds, 0, sizeof(w32_fd_set)); memset(&read_ready_fds, 0, sizeof(w32_fd_set));
memset(&write_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) { if (fds > MAX_FDS) {
errno = EINVAL; errno = EINVAL;
debug("ERROR: fds: %d", fds); 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) { if (exceptfds) {
errno = EOPNOTSUPP; errno = EOPNOTSUPP;
debug("ERROR: exceptfds not supported"); debug("ERROR: exceptfds not supported");
abort();
return -1; return -1;
} }

View File

@ -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; struct timeval timeout, start, *timeoutp = NULL;
DBG(debug("packet_read()")); 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, setp = calloc(howmany(state->connection_in + 1,
NFDBITS), sizeof(fd_mask)); NFDBITS), sizeof(fd_mask));
#else #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 * Otherwise, wait for some data to arrive, add it to the
* buffer, and try again. * buffer, and try again.
*/ */
#if(1)//ndef WIN32_FIXME #if(0)//ndef WIN32_FIXME
memset(setp, 0, howmany(state->connection_in + 1, memset(setp, 0, howmany(state->connection_in + 1,
NFDBITS) * sizeof(fd_mask)); NFDBITS) * sizeof(fd_mask));
#else #else