]> sourceware.org Git - newlib-cygwin.git/commitdiff
* cygpath.c (get_long_name): Cover the case that GetLongPathName
authorCorinna Vinschen <corinna@vinschen.de>
Thu, 27 Jul 2006 21:07:33 +0000 (21:07 +0000)
committerCorinna Vinschen <corinna@vinschen.de>
Thu, 27 Jul 2006 21:07:33 +0000 (21:07 +0000)
doesn't return valid information for non-existant files.  Just return
incoming filename in that case.

winsup/utils/ChangeLog
winsup/utils/cygpath.cc

index cf54994c9a809b5e6fd8743edf11287f16f6730e..80b1bfd97da56460ac44009963801d72d32b1fa4 100644 (file)
@@ -1,3 +1,9 @@
+2006-07-27  Corinna Vinschen  <corinna@vinschen.de>
+
+       * cygpath.c (get_long_name): Cover the case that GetLongPathName
+       doesn't return valid information for non-existant files.  Just return
+       incoming filename in that case.
+
 2006-07-03  Kazuhiro Fujieda  <fujieda@jaist.ac.jp>
 
        * Makefile.in: Build setmetamode.exe.
index d3e8ba6584c091cb3461c4c43a4032352e95f20e..52282a615c8158396211974f0238c2a4325c2f16 100644 (file)
@@ -239,11 +239,17 @@ get_long_name (const char *filename, DWORD& len)
     GetLongPathName = get_long_path_name_w32impl;
 
   len = GetLongPathName (filename, buf, MAX_PATH);
-  if (len == 0 && GetLastError () == ERROR_INVALID_PARAMETER)
+  if (len == 0)
     {
-      fprintf (stderr, "%s: cannot create long name of %s\n", prog_name,
-              filename);
-      exit (2);
+      if (GetLastError () == ERROR_INVALID_PARAMETER)
+       {
+         fprintf (stderr, "%s: cannot create long name of %s\n", prog_name,
+                  filename);
+         exit (2);
+       }
+      buf[0] = '\0';
+      strncat (buf, filename, MAX_PATH - 1);
+      len = strlen (buf);
     }
   sbuf = (char *) malloc (len + 1);
   if (!sbuf)
This page took 0.036724 seconds and 5 git commands to generate.