diff options
Diffstat (limited to 'winsup/utils/cygpath.cc')
-rw-r--r-- | winsup/utils/cygpath.cc | 14 |
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) |