delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/06/05/21:28:18

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-ID: <3CFEBA86.9313EF4B@mvista.com>
Date: Wed, 05 Jun 2002 18:27:34 -0700
From: Michael Eager <eager AT mvista DOT com>
Organization: MontaVista Software, Inc.
X-Accept-Language: en
MIME-Version: 1.0
To: "Larry Hall (RFK Partners, Inc)" <lhall AT rfk DOT com>
CC: Cygwin Mailing List <cygwin AT cygwin DOT com>
Subject: Re: DOS Special Names
References: <5 DOT 1 DOT 0 DOT 14 DOT 0 DOT 20020605152947 DOT 08add3a0 AT pop DOT ma DOT ultranet DOT com>

"Larry Hall (RFK Partners, Inc)" wrote:
> 
> At 03:29 PM 6/5/2002, Michael Eager wrote:
> >I've run into a problem creating a regular file with the name
> >COM20000.  I can create this file from Windows, either using
> >fopen() or in a Command window, but not when using Cygwin.
> >Windows does prevent creating files named COMx, where x is a
> >single digit.
> >
> >The code in winsup/cygwin/path.cc checks to see if the file
> >name is COM followed by any integer, not just a single digit.
> >Is this intentional or an error?
> >
> >Shouldn't Cygwin check to see if there is an installed driver
> >named COM (or AUX, etc.) rather than just assume that all COMxxxx
> >are supposed to be devices?
> 
> I agree that it makes sense for Cygwin not to restrict more file names
> than Windows does.  Feel free to submit a patch for this, if you're so
> inclined.

Index: path.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/path.cc,v
retrieving revision 1.219
diff -u -r1.219 path.cc
--- path.cc     5 Jun 2002 04:01:42 -0000       1.219
+++ path.cc     6 Jun 2002 01:25:41 -0000
@@ -916,7 +916,7 @@
       devn = FH_MEM;
       unit = 4;
     }
-  else if (deveqn ("com", 3) && (unit = digits (name + 3)) >= 0)
+  else if (deveqn ("com", 3) && (unit = digits (name + 3)) >= 0 && unit < 10)
     devn = FH_SERIAL;
   else if (deveqn ("ttyS", 4) && (unit = digits (name + 4)) >= 0)
     {
@@ -1070,7 +1070,7 @@
       if (p)
        unix_path = p + 1;
       if (udeveqn ("com", 3)
-        && (unit = digits (unix_path + 3)) >= 0)
+        && (unit = digits (unix_path + 3)) >= 0 && unit < 10)
        devn = FH_SERIAL;
     }


--
Michael Eager     eager AT mvista DOT com	408-328-8426	
MontaVista Software, Inc. 1237 E. Arques Ave., Sunnyvale, CA  94085

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


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