[Top][All Lists]

[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: Mon, 11 Oct 2004 13:15:56 -0700

Conrad T. Pino <Conrad@pino.com> writes:

> > From: Mark D. Baushke
> > 
> > Hmmm... I wish I had a better #define to use to control this behavior...
> > I suspect it may not be a problem in a cygwin environment, but I could
> > be wrong.
> Why not create a specific #define for this purpose?

I would not object to that approach.

> The Windows Build has platform specific peculiarities that don't mesh with
> the *nix build at all.  File "windows-NT/config.h.in.footer" is where the
> Windows Build #defines HAVE_WINSOCK_H and other stuff.  Take a look to get
> a sense of what we're doing there and propose a feature specific macro name.
> I'm of the opinion that CVS Windows binary should be built for the bare
> platform i.e. no Cygwin, MinGW, etc. environments.

Hmmm... I susepect folks will not like us much should cvs be compiled in
such other environment and not work properly as a result...

> > The following replacement functions should fix your problem (let me know
> > if it does not). If anyone has a 'better' way to deal with the problem,
> > please let me know...
> The patch I tested follows at the end of this message.
> I used:
>       #ifndef HAVE_WINSOCK_H
> instead of:
>       #if !defined(HAVE_WINSOCK_H)

If we use a special-purpose define for this, then that would be a fine
idea. Otherwise, we may have other platforms that have similar problems
and it may be useful to have a logical expression of exceptions... (I do
not feel very strongly about it.)

> I won't commit until I see a response from you regarding proposal to use
> new macro name other than HAVE_WINSOCK_H.

Actually, I think the select would be a good idea in the cases where
stdout is a socket, so we may want to just add a bit more glue in the
error condition... something like this perhaps?

        -- Mark

Index: client.c
RCS file: /cvs/ccvs/src/client.c,v
retrieving revision 1.397
diff -u -p -u -p -r1.397 client.c
--- client.c    8 Oct 2004 19:45:19 -0000       1.397
+++ client.c    11 Oct 2004 20:10:33 -0000
@@ -2672,7 +2672,17 @@ handle_m (char *args, int len)
     FD_SET (STDOUT_FILENO, &wfds);
     s = select (STDOUT_FILENO+1, NULL, &wfds, NULL, NULL);
     if (s < 1)
+    {
+#if defined(WSAENOTSOCK)
+           error (1, 0, "cannot write to stdout: %s",
+                  SOCK_STRERROR (SOCK_ERRNO));
         perror ("cannot write to stdout");
+#endif /* HAVE_WINSOCK_H */
+    }
     fwrite (args, len, sizeof (*args), stdout);
     putc ('\n', stdout);
@@ -2734,7 +2744,17 @@ handle_e (char *args, int len)
      * terminate cvs.
     if (s < 1)
+    {
+#if defined(WSAENOTSOCK)
+           fperrmsg (stdout, 1, 0, "cannot write to stderr: %s",
+                     SOCK_STRERROR (SOCK_ERRNO));
         fperrmsg (stdout, 1, errno, "cannot write to stderr");
+#endif /* HAVE_WINSOCK_H */
+    }
     fwrite (args, len, sizeof (*args), stderr);
     putc ('\n', stderr);

reply via email to

[Prev in Thread] Current Thread [Next in Thread]