diff --git a/contrib/win32/win32compat/inc/defs.h b/contrib/win32/win32compat/inc/defs.h index 38c9cb5..3e8b604 100644 --- a/contrib/win32/win32compat/inc/defs.h +++ b/contrib/win32/win32compat/inc/defs.h @@ -47,8 +47,9 @@ #define W32_SIGTERM 8 #define W32_SIGTTIN 9 #define W32_SIGTTOU 10 +#define W32_SIGWINCH 11 -#define W32_SIGMAX 11 +#define W32_SIGMAX 12 /* signal action codes*/ #define W32_SIG_ERR -1 diff --git a/contrib/win32/win32compat/inc/signal.h b/contrib/win32/win32compat/inc/signal.h index 5e4d95e..712d029 100644 --- a/contrib/win32/win32compat/inc/signal.h +++ b/contrib/win32/win32compat/inc/signal.h @@ -25,6 +25,7 @@ #define SIGTERM W32_SIGTERM #define SIGTTIN W32_SIGTTIN #define SIGTTOU W32_SIGTTOU +#define SIGWINCH W32_SIGWINCH #define SIG_DFL W32_SIG_DFL #define SIG_IGN W32_SIG_IGN diff --git a/log.c b/log.c index 04eea20..10e3160 100644 --- a/log.c +++ b/log.c @@ -434,7 +434,7 @@ do_log(LogLevel level, const char *fmt, va_list args) } else { vsnprintf(msgbuf, sizeof(msgbuf), fmt, args); } -#ifdef WIN32_FIXME +#ifdef WIN32_FIXME//N strncpy(fmtbuf, msgbuf, sizeof(fmtbuf)); #else strnvis(fmtbuf, msgbuf, sizeof(fmtbuf), @@ -449,7 +449,7 @@ do_log(LogLevel level, const char *fmt, va_list args) log_handler = tmp_handler; } else if (log_on_stderr) { snprintf(msgbuf, sizeof msgbuf, "%s\r\n", fmtbuf); -#ifdef WIN32_FIXME +#ifdef WIN32_FIXME//N _write(STDERR_FILENO, msgbuf, strlen(msgbuf)); #else (void)write(log_stderr_fd, msgbuf, strlen(msgbuf)); diff --git a/misc.c b/misc.c index 275d511..b9779dd 100644 --- a/misc.c +++ b/misc.c @@ -81,15 +81,6 @@ chop(char *s) int set_nonblock(int fd) { -#if(0)//def WIN32_FIXME - - int on = 1; - - ioctlsocket(fd, FIONBIO, &on); - - return 0; - -#else int val; val = fcntl(fd, F_GETFL, 0); @@ -109,21 +100,11 @@ set_nonblock(int fd) return (-1); } return (0); -#endif /* else WIN32_FIXME */ } int unset_nonblock(int fd) { -#if(0)//def WIN32_FIXME - - int on = 0; - - ioctlsocket(fd, FIONBIO, &on); - - return 0; - -#else int val; val = fcntl(fd, F_GETFL, 0); @@ -143,7 +124,6 @@ unset_nonblock(int fd) return (-1); } return (0); -#endif } const char * @@ -243,7 +223,7 @@ pwcopy(struct passwd *pw) copy->pw_class = xstrdup(pw->pw_class); #endif -#ifdef WIN32_FIXME +#ifdef WIN32_FIXME//N copy -> pw_dir = (char*)_wcsdup((wchar_t*)pw->pw_dir); #else copy->pw_dir = xstrdup(pw->pw_dir); diff --git a/moduli.c b/moduli.c index 460269e..ffa848c 100644 --- a/moduli.c +++ b/moduli.c @@ -458,7 +458,7 @@ write_checkpoint(char *cpfile, u_int32_t lineno) logit("write_checkpoint: temp pathname too long"); return; } -#ifndef WIN32_FIXME +#ifndef WIN32_FIXME//N //PRAGMA:TODO if ((r = mkstemp(tmp)) == -1) { logit("mkstemp(%s): %s", tmp, strerror(errno)); diff --git a/nchan.c b/nchan.c index 218595d..35fdd81 100644 --- a/nchan.c +++ b/nchan.c @@ -75,12 +75,6 @@ * ACTIONS: should never update the channel states */ -#ifdef WIN32_FIXME - - //void StopSocketThreads(); - -#endif - static void chan_send_ieof1(Channel *); static void chan_send_oclose1(Channel *); static void chan_send_close2(Channel *); @@ -122,24 +116,6 @@ chan_rcvd_oclose1(Channel *c) { debug2("channel %d: rcvd oclose", c->self); - /* - * FIXME. This function forces stopping all socket threads - * at next select. This workaround nivelate problem with - * infinite hangs up in below scenario: - * - * a) read select start. - * b) write select start. - * c) read select ends: SSH2_MSG_CHANNEL_CLOSE received. - * d) close input channel. - * e) now write select may never ends. - */ - - #ifdef WIN32_FIXME - - //StopSocketThreads(); - - #endif - switch (c->istate) { case CHAN_INPUT_WAIT_OCLOSE: chan_set_istate(c, CHAN_INPUT_CLOSED); @@ -188,7 +164,7 @@ chan_ibuf_empty(Channel *c) case CHAN_INPUT_WAIT_DRAIN: if (compat20) { if (!(c->flags & (CHAN_CLOSE_SENT | CHAN_LOCAL))) { - #ifdef WIN32_FIXME + #ifdef WIN32_FIXME//N // reset the other side if tty to be how it was before if (c->isatty) { char *inittermseq = diff --git a/packet.c b/packet.c index 0ae35fb..b8bba2b 100644 --- a/packet.c +++ b/packet.c @@ -415,7 +415,7 @@ ssh_packet_connection_af(struct ssh *ssh) if (getsockname(ssh->state->connection_out, (struct sockaddr *)&to, &tolen) < 0) return 0; -#ifdef WIN32_FIXME +#ifdef WIN32_FIXME//N if (to.ss_family == AF_INET) return 1; #endif @@ -1314,15 +1314,10 @@ 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 int d = howmany(state->connection_in + 1, NFDBITS); d = sizeof(fd_mask); setp = calloc(howmany(state->connection_in + 1, NFDBITS), sizeof(fd_mask)); -#else - setp = xmalloc(sizeof(fd_set)); - FD_ZERO(setp); -#endif if (setp == NULL) return SSH_ERR_ALLOC_FAIL; @@ -1354,12 +1349,8 @@ 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 memset(setp, 0, howmany(state->connection_in + 1, NFDBITS) * sizeof(fd_mask)); -#else - FD_ZERO(setp); -#endif FD_SET(state->connection_in, setp); @@ -2094,24 +2085,16 @@ ssh_packet_write_wait(struct ssh *ssh) int ret, r, ms_remain = 0; struct timeval start, timeout, *timeoutp = NULL; struct session_state *state = ssh->state; -#if(1)//ndef WIN32_FIXME + setp = calloc(howmany(state->connection_out + 1, NFDBITS), sizeof(fd_mask)); -#else - setp = (fd_set *)xmalloc(sizeof(fd_set)); - FD_ZERO(setp); -#endif - + if (setp == NULL) return SSH_ERR_ALLOC_FAIL; ssh_packet_write_poll(ssh); while (ssh_packet_have_data_to_write(ssh)) { -#if(1)//ndef WIN32_FIXME memset(setp, 0, howmany(state->connection_out + 1, NFDBITS) * sizeof(fd_mask)); -#else - FD_ZERO(setp); -#endif FD_SET(state->connection_out, setp); diff --git a/progressmeter.c b/progressmeter.c index bfca249..16cd68e 100644 --- a/progressmeter.c +++ b/progressmeter.c @@ -81,7 +81,7 @@ static const char unit[] = " KMGT"; static int can_output(void) { -#ifndef WIN32_FIXME +#ifndef WIN32_FIXME//R return (getpgrp() == tcgetpgrp(STDOUT_FILENO)); #else return 1; @@ -123,7 +123,7 @@ format_size(char *buf, int size, off_t bytes) void refresh_progress_meter(void) { -#ifndef WIN32_FIXME +#if(1)//ndef WIN32_FIXME char buf[MAX_WINSIZE + 1]; time_t now; off_t transferred; @@ -248,10 +248,8 @@ update_progress_meter(int ignore) if (can_output()) refresh_progress_meter(); -#ifndef WIN32_FIXME signal(SIGALRM, update_progress_meter); alarm(UPDATE_INTERVAL); -#endif errno = save_errno; } @@ -271,17 +269,15 @@ start_progress_meter(const char *f, off_t filesize, off_t *ctr) if (can_output()) refresh_progress_meter(); -#ifndef WIN32_FIXME + signal(SIGALRM, update_progress_meter); signal(SIGWINCH, sig_winch); alarm(UPDATE_INTERVAL); -#endif } void stop_progress_meter(void) { -#ifndef WIN32_FIXME alarm(0); if (!can_output()) @@ -292,7 +288,6 @@ stop_progress_meter(void) refresh_progress_meter(); atomicio(vwrite, STDOUT_FILENO, "\n", 1); -#endif } /*ARGSUSED*/ @@ -305,7 +300,7 @@ sig_winch(int sig) static void setscreensize(void) { - #ifndef WIN32_FIXME + #ifndef WIN32_FIXME//N struct winsize winsize; if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &winsize) != -1 &&