[newlib-cygwin] Cygwin: remove old cruft from path_conv::check

Ken Brown kbrown@sourceware.org
Wed Sep 25 00:05:00 GMT 2019


https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=9f24260ee90bec2506ae5c624dc06ab3fc67ae64

commit 9f24260ee90bec2506ae5c624dc06ab3fc67ae64
Author: Ken Brown <kbrown@cornell.edu>
Date:   Sat Sep 21 13:09:09 2019 -0400

    Cygwin: remove old cruft from path_conv::check
    
    Prior to commit b0717aae, path_conv::check had the following code:
    
          if (strncmp (path, "\\\\.\\", 4))
            {
              /* Windows ignores trailing dots and spaces in the last path
                 component, and ignores exactly one trailing dot in inner
                 path components. */
              char *tail = NULL;
              [...]
              if (!tail || tail == path)
                /* nothing */;
              else if (tail[-1] != '\\')
                {
                  *tail = '\0';
              [...]
            }
    
    Commit b0717aae0 intended to disable this code, but it inadvertently
    disabled only part of it.  In particular, the declaration of the local
    tail variable was in the disabled code, but the following remained:
    
              if (!tail || tail == path)
                /* nothing */;
              else if (tail[-1] != '\\')
                {
                  *tail = '\0';
              [...]
            }
    
    [A later commit removed the disabled code.]
    
    The tail variable here points into a string different from path,
    causing that string to be truncated under some circumstances.  See
    
      https://cygwin.com/ml/cygwin/2019-09/msg00001.html
    
    for more details.
    
    This commit fixes the problem by removing the leftover code
    that was intended to be removed in b0717aae.

Diff:
---
 winsup/cygwin/path.cc | 13 -------------
 1 file changed, 13 deletions(-)

diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index c13701a..2fbacd8 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -1168,19 +1168,6 @@ path_conv::check (const char *src, unsigned opt,
 
       if (dev.isfs ())
 	{
-	  if (strncmp (path, "\\\\.\\", 4))
-	    {
-	      if (!tail || tail == path)
-		/* nothing */;
-	      else if (tail[-1] != '\\')
-		*tail = '\0';
-	      else
-		{
-		  error = ENOENT;
-		  return;
-		}
-	    }
-
 	  /* If FS hasn't been checked already in symlink_info::check,
 	     do so now. */
 	  if (fs.inited ()|| fs.update (get_nt_native_path (), NULL))



More information about the Cygwin-cvs mailing list