RE: CVS Feature Branch - version - cannot write to stdout

From:

Conrad T. Pino

Subject:

RE: CVS Feature Branch - version - cannot write to stdout

Date:

Mon, 11 Oct 2004 11:40:01 -0700

> From: Mark D. Baushke
> Sent: Saturday, October 09, 2004 12:26
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi Conrad,
>
> The error is arising from handle_m() in client.c The value of the select
> is either 0 (this should not happen as we are not specifing a timeout)
> which means that the select() timed-out or -1 which means that there
> were no ready descriptors.
> I see that it may be possible to get more information if we examine the
> SOCKET_ERROR and that WSAGetLastError may be used to find the most
> recent socket error.
> If you modify the handle_m() function to grok the Windows way to get
> more information and print it, something like this:
static void
handle_m (char *args, int len)
{
fd_set wfds;
int s;
/* In the case where stdout and stderr point to the same place,
fflushing stderr will make output happen in the correct order.
Often stderr will be line-buffered and this won't be needed,
but not always (is that true? I think the comment is probably
based on being confused between default buffering between
stdout and stderr. But I'm not sure). */
fflush (stderr);
FD_ZERO (&wfds);
FD_SET (STDOUT_FILENO, &wfds);
s = select (STDOUT_FILENO+1, NULL, &wfds, NULL, NULL);
fprintf( stderr, "WSAGetLastError test, s = %d\n", s );
if (s < 1)
{
int sockerr = WSAGetLastError( );
perror ("cannot write to stdout");
fprintf( stderr, "WSAGetLastError = %d\n", sockerr );
}
fwrite (args, len, sizeof (*args), stdout);
putc ('\n', stdout);
}
> Thanks,
> -- Mark
==================================
Attempt with CVSHome.org server:
H:\cvs-1.12>windebug\cvs version
Client: Concurrent Versions System (CVS) 1.12.9.1 (client)
Server: WSAGetLastError test, s = -1
cannot write to stdout: No error
WSAGetLastError = 10038
Concurrent Versions System (CVS) 1.11.15-scast-vc-1.5.2 (client/server)
H:\cvs-1.12>cd WinDebug
==================================
Attempt with local LAN server:
H:\cvs-1.12\WinDebug>cvs version
Client: Concurrent Versions System (CVS) 1.12.9.1 (client)
Server: WSAGetLastError test, s = -1
cannot write to stdout: No such file or directory
WSAGetLastError = 10038
Concurrent Versions System (CVS) 1.11.17 (client/server)
H:\cvs-1.12\WinDebug>
==================================
Error code explanation:
WSAENOTSOCK = 10038, Socket operation on nonsocket.
An operation was attempted on something that is not a socket.
Either the socket handle parameter did not reference a valid
socket, or for select, a member of an fd_set was not valid.
==================================
Conrad