Subject: Re: Opening COM2
From: [email-masked] (Jim Balter)

4 Apr 1997 02:29:37 -0800
Approved: [email-masked]
Distribution: cygnus
Message-ID: <[email-masked]>
References: <[email-masked]>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 4.0b2 (WinNT; I)
Original-To: Bob Wilson <[email-masked]>
Original-CC: [email-masked]
X-Priority: 3 (Normal)
Original-Sender: [email-masked]

Bob Wilson wrote:
> 
> I have a program which ran correctly when compiled on a gnu-win32
> package from about a year ago, but is failing when compiled with 17.1
> beta.  The machine is running NT 3.51 and COM2 is connected to a
> microprocessor with only td, rd and ground connected.  The open:
> 
>         if ((comfd = open("com2", O_RDWR | O_TEXT)) <= 0) {
>             fprintf(stderr, "Cmd: Unable to open terminal\n");
>             exit(1);
>         }
> 
> hangs.  It doesn't help to tie the modem control lines high, but if I
> generate a few characters on the rd line, the open completes.  In no
> case is there an error return.
> 
> I have looked for this problem in the FAQ and looked for archives of
> this mailing list, but both searches failed.
> 
> Can anyone help?

Marko Kohtala posted this patch to fix the problem the other day
(I haven't tried it and am not vouching for it):

diff -up b17.1/winsup/path.cc\~ b17.1/winsup/path.cc
--- b17.1/winsup/path.cc~       Wed Dec  4 05:23:01 1996
+++ b17.1/winsup/path.cc        Tue Apr  1 17:14:21 1997
@@ -1056,7 +1056,14 @@ symlink_check (const char *path, char *b
       char cookie_buf[sizeof (SYMLINK_COOKIE) - 1];
       DWORD done;
 
-      if (! ReadFile (h, cookie_buf, sizeof (cookie_buf), &done, 0))
+      if ((GetFileType (h) & ~FILE_TYPE_REMOVE) != FILE_TYPE_DISK)
+       {
+         /* It is not a disk file, can not be a symlink */
+         *syml = 0;
+         *exec = 0;
+         res = 0;
+       }
+      else if (! ReadFile (h, cookie_buf, sizeof (cookie_buf), &done,
0))
        {
          set_errno (EIO);
        }

--
<J Q B>
-
For help on using this list, send a message to
"[email-masked]" with one line of text: "help".