]> sourceware.org Git - newlib-cygwin.git/commitdiff
2004-09-22 Pierre Humblet <pierre.humblet@ieee.org>
authorPierre Humblet <phumblet@phumblet.no-ip.org>
Thu, 23 Sep 2004 00:32:08 +0000 (00:32 +0000)
committerPierre Humblet <phumblet@phumblet.no-ip.org>
Thu, 23 Sep 2004 00:32:08 +0000 (00:32 +0000)
* path.cc (normalize_win32_path): Only look for : in second position.
Avoid infinite loop with names starting in double dots.
(mount_info::conv_to_win32_path): Do not worry about a trailing dot.
(hash_path_name): Ditto.

winsup/cygwin/ChangeLog
winsup/cygwin/path.cc

index 9627b78932d1ad56f04dc08643e7dfd53f5e82a6..84cc74923c202795f52ef2a415e2ec55ab9a9105 100644 (file)
@@ -1,3 +1,10 @@
+2004-09-22  Pierre Humblet <pierre.humblet@ieee.org>
+
+       * path.cc (normalize_win32_path): Only look for : in second position.
+       Avoid infinite loop with names starting in double dots.
+       (mount_info::conv_to_win32_path): Do not worry about a trailing dot. 
+       (hash_path_name): Ditto.
+
 2004-09-20  Christopher Faylor  <cgf@timesys.com>
 
        * exceptions.cc (sig_handle_tty_stop): Set flag earlier.
index 769c197c4a1d0ba9bbbc2b6f8e780bef19144bbf..4b922d7e2f50697b42dd434a1d605d299929ea76 100644 (file)
@@ -978,7 +978,7 @@ normalize_win32_path (const char *src, char *dst, char **tail)
          src += 2;
        }
     }
-  else if (strchr (src, ':') == NULL && *src != '/')
+  else if (!isdrive(src) && *src != '/')
     {
       if (beg_src_slash)
        dst += cygheap->cwd.get_drive (dst);
@@ -1023,6 +1023,7 @@ normalize_win32_path (const char *src, char *dst, char **tail)
              int n = strspn (src, ".");
              if (!src[n] || isdirsep (src[n])) /* just dots... */
                return ENOENT;
+             *dst++ = *src++;
            }
        }
       /* Otherwise, add char to result.  */
@@ -1454,8 +1455,7 @@ mount_info::conv_to_win32_path (const char *src_path, char *dst, device& dev,
       int n = mount_table->cygdrive_len - 1;
       int unit;
 
-      if (!src_path[n] ||
-         (src_path[n] == '/' && src_path[n + 1] == '.' && !src_path[n + 2]))
+      if (!src_path[n])
        {
          unit = 0;
          dst[0] = '\0';
@@ -3249,15 +3249,13 @@ hash_path_name (__ino64_t hash, const char *name)
     }
 
 hashit:
-  /* Build up hash.  Ignore single trailing slash or \a\b\ != \a\b or
-     \a\b\.  but allow a single \ if that's all there is. */
+  /* Build up hash. Name is already normalized */
   do
     {
       int ch = cyg_tolower (*name);
       hash = ch + (hash << 6) + (hash << 16) - hash;
     }
-  while (*++name != '\0' &&
-        !(*name == '\\' && (!name[1] || (name[1] == '.' && !name[2]))));
+  while (*++name != '\0');
   return hash;
 }
 
This page took 0.040196 seconds and 5 git commands to generate.