]> sourceware.org Git - newlib-cygwin.git/commitdiff
* path.cc (path_conv::set_normalized_path): Drop strip_tail argument.
authorCorinna Vinschen <corinna@vinschen.de>
Tue, 13 May 2008 13:44:04 +0000 (13:44 +0000)
committerCorinna Vinschen <corinna@vinschen.de>
Tue, 13 May 2008 13:44:04 +0000 (13:44 +0000)
Never strip trailing dots and spaces.
* (path_conv::check): Accomodate above change.
* path.h (path_conv::operator=): Ditto
* dtable.cc (build_fh_dev): Ditto.
* fhandler.h (fhandler_base::set_name): Ditto.

* path.cc (transform_chars): Disable converting trailing dots and
spaces.

* path.cc (path_conv::check): Remove two disabled code snippets.

winsup/cygwin/ChangeLog
winsup/cygwin/dtable.cc
winsup/cygwin/fhandler.h
winsup/cygwin/path.cc
winsup/cygwin/path.h

index a1df7692dce3c3811302ab74a4af7d31f43089af..d65a958ed58c02f1d6683d879d521b3fec55d4aa 100644 (file)
@@ -1,3 +1,17 @@
+2008-05-13  Corinna Vinschen  <corinna@vinschen.de>
+
+       * path.cc (path_conv::set_normalized_path): Drop strip_tail argument.
+       Never strip trailing dots and spaces.
+       * (path_conv::check): Accomodate above change.
+       * path.h (path_conv::operator=): Ditto
+       * dtable.cc (build_fh_dev): Ditto.
+       * fhandler.h (fhandler_base::set_name): Ditto.
+
+       * path.cc (transform_chars): Disable converting trailing dots and
+       spaces.
+
+       * path.cc (path_conv::check): Remove two disabled code snippets.
+
 2008-05-13  Corinna Vinschen  <corinna@vinschen.de>
 
        * random.cc (initstate): Align to POSIX definition.
index 2192bcf09e7289d9ca118b5beaeaa0d908c340b9..7f997d4798267c3189e290bed1170d16e7ed7f01 100644 (file)
@@ -396,9 +396,9 @@ build_fh_dev (const device& dev, const char *unix_name)
 {
   path_conv pc (dev);
   if (unix_name)
-    pc.set_normalized_path (unix_name, false);
+    pc.set_normalized_path (unix_name);
   else
-    pc.set_normalized_path (dev.name, false);
+    pc.set_normalized_path (dev.name);
   return build_fh_pc (pc);
 }
 
index ee08ccd9f5e4dd7e4bb4c8f9d5cd5578cda5423f..89970b605363adaaf06583f0b5416dd116c42c18 100644 (file)
@@ -153,7 +153,7 @@ class fhandler_base
   path_conv pc;
 
   virtual void set_name (path_conv &pc);
-  virtual void set_name (const char *s) {pc.set_normalized_path (s, false);}
+  virtual void set_name (const char *s) {pc.set_normalized_path (s);}
   int error () const {return pc.error;}
   void set_error (int error) {pc.error = error;}
   bool exists () const {return pc.exists ();}
index 01847c742c58c063f6a15347453628279e1af3b6..1c1217d9d79aa2253433a5d20fa37b66dda18c08 100644 (file)
@@ -531,17 +531,9 @@ path_conv::fillin (HANDLE h)
 }
 
 void
-path_conv::set_normalized_path (const char *path_copy, bool strip_tail)
+path_conv::set_normalized_path (const char *path_copy)
 {
   char *p = strchr (path_copy, '\0');
-
-  if (strip_tail)
-    {
-      while (*--p == '.' || *p == ' ')
-       continue;
-      *++p = '\0';
-    }
-
   size_t n = 1 + p - path_copy;
 
   normalized_path = path + sizeof (path) - n;
@@ -605,10 +597,14 @@ transform_chars (PUNICODE_STRING upath, USHORT start_idx, bool managed)
   for (buf += start_idx; buf <= end; ++buf)
     if (*buf < 128)
       *buf = tfx[*buf];
+#if 0
   /* Win32 can't handle trailing dots and spaces.  Transform the last of them
      to the private use area, too, to create a valid Win32 filename. */
+  if (*end == L'\\')
+    --end;
   if (*end == L'.' || *end == L' ')
     *end |= 0xf000;
+#endif
 }
 
 PUNICODE_STRING
@@ -1171,7 +1167,6 @@ virtual_component_retry:
     add_ext_from_sym (sym);
 
 out:
-  bool strip_tail = false;
   if (dev.devn == FH_NETDRIVE && component)
     {
       /* This case indicates a non-existant resp. a non-retrievable
@@ -1203,35 +1198,10 @@ out:
     {
       if (strncmp (path, "\\\\.\\", 4))
        {
-#if 0
-         /* Windows ignores trailing dots and spaces in the last path
-            component, and ignores exactly one trailing dot in inner
-            path components. */
-         char *tail = NULL;
-         for (char *p = path; *p; p++)
-           {
-             if (*p != '.' && *p != ' ')
-               tail = NULL;
-             else if (!tail)
-               tail = p;
-             if (tail && p[1] == '\\')
-               {
-                 if (p > tail || *tail != '.')
-                   {
-                     error = ENOENT;
-                     return;
-                   }
-                 tail = NULL;
-               }
-           }
-#endif
          if (!tail || tail == path)
            /* nothing */;
          else if (tail[-1] != '\\')
-           {
-             *tail = '\0';
-             strip_tail = true;
-           }
+           *tail = '\0';
          else
            {
              error = ENOENT;
@@ -1255,11 +1225,6 @@ out:
        set_exec (0);
     }
 
-#if 0
-  if (issocket ())
-    devn = FH_SOCKET;
-#endif
-
   if (opt & PC_NOFULL)
     {
       if (is_relpath)
@@ -1296,7 +1261,7 @@ out:
     {
       if (tail < path_end && tail > path_copy + 1)
        *tail = '/';
-      set_normalized_path (path_copy, strip_tail);
+      set_normalized_path (path_copy);
       if (is_msdos && !(opt & PC_NOWARN))
        warn_msdos (src);
     }
index e121280ce421289aad5c8acfc8e06d5d01c530b2..ab6dda79a4c6e5b4e67ae390f4a4ec9f370f6383 100644 (file)
@@ -253,7 +253,7 @@ class path_conv
   path_conv &operator =(path_conv &pc)
   {
     memcpy (this, &pc, pc.size ());
-    set_normalized_path (pc.normalized_path, false);
+    set_normalized_path (pc.normalized_path);
     wide_path = NULL;
     return *this;
   }
@@ -280,7 +280,7 @@ class path_conv
   unsigned __stdcall ndisk_links (DWORD);
   char *normalized_path;
   size_t normalized_path_size;
-  void set_normalized_path (const char *, bool) __attribute__ ((regparm (3)));
+  void set_normalized_path (const char *) __attribute__ ((regparm (2)));
   DWORD get_symlink_length () { return symlink_length; };
  private:
   DWORD symlink_length;
This page took 0.048333 seconds and 5 git commands to generate.