www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/04/01/17:38:53

From: Marko DOT Kohtala AT ntc DOT nokia DOT com (Kohtala Marko)
Subject: A patch for _opening com1
1 Apr 1997 17:38:53 -0800 :
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <199704011427.RAA13248.cygnus.gnu-win32@axl01it.ntc.nokia.com>
Reply-To: Marko DOT Kohtala AT ntc DOT nokia DOT com
Original-To: gnu-win32 AT cygnus DOT com
Original-Sender: owner-gnu-win32 AT cygnus DOT com

Opening COM1 seems to block in symlink_check in path.cc when the
opened file is read to see if it is a symlink.

Therefore a patch like the one below might be in order. I have not
tried it, not even compiled, since I do not have time to set up the
system for building itself. I hope there will be soon a beta available
which can handle COM ports.

We hope to be able to use other COMn devices besides com1 and com2, so
this fix is not sufficient. hinfo_vec::build_fhandler needs to be
changed too. Perhaps a similar check there.

I've just now joined the mailing list, so hopefully this matter is not
covered already here.

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_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);
 	}

-- 
---
Marko Kohtala - Marko DOT Kohtala AT ntc DOT nokia DOT com, Marko DOT Kohtala AT hut DOT fi
-
For help on using this list, send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019