--- server.c 2006-04-08 23:22:22.566540800 -1000 +++ modified-server.c 2006-04-08 22:15:40.581969600 -1000 @@ -5076,6 +5076,23 @@ buf_to_net = fd_buffer_initialize (STDOUT_FILENO, 0, outbuf_memory_error); + +#if defined (__CYGWIN32__) + /* On cygwin, certain shells, tcsh in particular, open stdin in + * text mode, and this causes CRLFs to map to LF, which corrupts + * files and causes communication problems because too few characters + * are received by the server. This code may be unnecessary if + * the shell ever gets fixed. + * + * Normally, pipes are opened in binary anyway, but ssh creates an + * interactive shell when it starts cvs server. Consequently, the + * behavior may be poorly or not defined. + */ + + FILE* f = freopen (NULL, "rb", stdin); /* Ensure that stdin is binary */ + +#endif /* defined (__CYGWIN32__) */ + buf_from_net = stdio_buffer_initialize (stdin, 0, 1, outbuf_memory_error); saved_output = buf_nonio_initialize (outbuf_memory_error);