[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: CVS Feature Branch - version - cannot write to stdout
From: |
Mark D. Baushke |
Subject: |
Re: CVS Feature Branch - version - cannot write to stdout |
Date: |
Fri, 22 Oct 2004 16:45:25 -0700 |
Hi Conrad,
I am hoping that the following patch will work for your problem. If it
does, then I'll commit it. We will lose any error messages that the
select() may put into SOCK_ERRNO which is unfortunate. It might be
'better' to come up with a select() wrapper function in the general case
for windows to use, but I am not sure how useful it would be in this
case.
-- Mark
2004-10-22 Mark D. Baushke <mdb@cvshome.org>
* client.c (handle_m, handle_e): Winsock is returning
SOCK_ERRNO == WSAENOTSOCK for select() problems and not
setting errno. Do not bother with printing an error from a
select() that is not returning an non-zero errno.
(Report from Conrad T. Pino <Conrad@Pino.com>.)
Index: src/client.c
===================================================================
RCS file: /cvs/ccvs/src/client.c,v
retrieving revision 1.402
diff -u -p -r1.402 client.c
--- src/client.c 22 Oct 2004 14:27:52 -0000 1.402
+++ src/client.c 22 Oct 2004 23:42:50 -0000
@@ -2666,8 +2666,9 @@ handle_m (char *args, size_t len)
fflush (stderr);
FD_ZERO (&wfds);
FD_SET (STDOUT_FILENO, &wfds);
+ errno = 0;
s = select (STDOUT_FILENO+1, NULL, &wfds, NULL, NULL);
- if (s < 1)
+ if (s < 1 && errno != 0)
perror ("cannot write to stdout");
fwrite (args, len, sizeof (*args), stdout);
putc ('\n', stdout);
@@ -2722,6 +2723,7 @@ handle_e (char *args, size_t len)
fflush (stdout);
FD_ZERO (&wfds);
FD_SET (STDERR_FILENO, &wfds);
+ errno = 0;
s = select (STDERR_FILENO+1, NULL, &wfds, NULL, NULL);
/*
* If stderr has problems, then adding a call to
@@ -2729,7 +2731,7 @@ handle_e (char *args, size_t len)
* will not work. So, try to write a message on stdout and
* terminate cvs.
*/
- if (s < 1)
+ if (s < 1 && errno != 0)
fperrmsg (stdout, 1, errno, "cannot write to stderr");
fwrite (args, len, sizeof (*args), stderr);
putc ('\n', stderr);
- Re: CVS Feature Branch - version - cannot write to stdout, (continued)
- Re: CVS Feature Branch - version - cannot write to stdout, Mark D. Baushke, 2004/10/09
- RE: CVS Feature Branch - version - cannot write to stdout, Conrad T. Pino, 2004/10/09
- Re: CVS Feature Branch - version - cannot write to stdout, Mark D. Baushke, 2004/10/09
- Re: CVS Feature Branch - version - cannot write to stdout, Derek Robert Price, 2004/10/09
- RE: CVS Feature Branch - version - cannot write to stdout, Conrad T. Pino, 2004/10/11
- Re: CVS Feature Branch - version - cannot write to stdout, Mark D. Baushke, 2004/10/11
- RE: CVS Feature Branch - version - cannot write to stdout, Conrad T. Pino, 2004/10/11
- Re: CVS Feature Branch - version - cannot write to stdout, Mark D. Baushke, 2004/10/11
- Re: CVS Feature Branch - version - cannot write to stdout, Mark D. Baushke, 2004/10/20
- RE: CVS Feature Branch - version - cannot write to stdout, Conrad T. Pino, 2004/10/22
- Re: CVS Feature Branch - version - cannot write to stdout,
Mark D. Baushke <=
- RE: CVS Feature Branch - version - cannot write to stdout, Conrad T. Pino, 2004/10/22
- RE: CVS Feature Branch - version - cannot write to stdout, Conrad T. Pino, 2004/10/22