delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1999/08/31/23:47:27

Message-Id: <199909010329.DAA106088@out1.ibm.net>
From: "Mark E." <snowball3 AT bigfoot DOT com>
To: djgpp-workers AT delorie DOT com
Date: Tue, 31 Aug 1999 23:29:58 -0400
MIME-Version: 1.0
Subject: Re: Bug in collect2.c
References: <199908310425 DOT EAA131526 AT out2 DOT ibm DOT net>
In-reply-to: <Pine.SUN.3.91.990831095603.9517T-100000@is>
X-mailer: Pegasus Mail for Win32 (v3.12a)
Reply-To: djgpp-workers AT delorie DOT com

> What case, exactly, do you want to fix?
> 

The patch below prevents 'c:\\\foo\bar' or 'c:/\/foo\bar' from being interpreted as 
a UNC while not interfering with '\\foo\bar'. 

*** src/libc/dos/io/putpath.c.orig	Thu Jun  3 13:27:34 1999
--- src/libc/dos/io/putpath.c	Tue Aug 31 23:17:14 1999
*************** _put_path2(const char *path, int offset)
*** 144,149 ****
--- 144,170 ----
        path = p + 5;
    }
  
+   /* Collapse multiple slashes and backslashes to a single slash
+      after a drive letter and colon so DOS will not mistakenly
+      interpret them as a network request.  */
+   if (*path && path[1] == ':' && (path[2] == '/' || path[2] == '\\'))
+   {
+     _farnspokeb(o, *path);
+     ++o;
+     ++path;
+ 
+     _farnspokeb(o, *path);
+     ++o;
+     ++path;
+ 
+     _farnspokeb(o, *path);
+     ++o;
+     ++path;
+ 
+     while (*path == '/' || *path == '\\')
+       ++path;
+   }
+ 
    /* collapse multiple slashes to a single slash */
    for (; *path; path++)
    {

----------------

I also discovered while testing the changes that _put_path gets called three times 
when using _fixpath. One call is in _fixpath, another in _use_lfn, and yet another 
in _get_volume_info. It's certainly a waste to do the same thing three times, but I 
don't see offhand what can be done about it.


--- 
Mark Elbrecht, snowball3 AT bigfoot DOT com
http://snowball.frogspace.net/

- Raw text -


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