Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2006-07-28 01:07:33 +0400
committerCorinna Vinschen <corinna@vinschen.de>2006-07-28 01:07:33 +0400
commitbc31293a0de4edadeec7b23f4b8ddddcce92d44a (patch)
tree1c3efa108936672435cfcfbd4be0f77389fdc1ac /winsup/utils/cygpath.cc
parentfd5879c110763e58717a23b259ecabd01a88684b (diff)
* 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.
Diffstat (limited to 'winsup/utils/cygpath.cc')
-rw-r--r--winsup/utils/cygpath.cc14
1 files changed, 10 insertions, 4 deletions
diff --git a/winsup/utils/cygpath.cc b/winsup/utils/cygpath.cc
index d3e8ba658..52282a615 100644
--- a/winsup/utils/cygpath.cc
+++ b/winsup/utils/cygpath.cc
@@ -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)