From: Corinna Vinschen Date: Thu, 27 Jul 2006 21:07:33 +0000 (+0000) Subject: * cygpath.c (get_long_name): Cover the case that GetLongPathName X-Git-Tag: newlib-csl-sourcerygxx-3_4_4-25~56 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=bc31293a0de4edadeec7b23f4b8ddddcce92d44a;p=newlib-cygwin.git * 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. --- diff --git a/winsup/utils/ChangeLog b/winsup/utils/ChangeLog index cf54994c9..80b1bfd97 100644 --- a/winsup/utils/ChangeLog +++ b/winsup/utils/ChangeLog @@ -1,3 +1,9 @@ +2006-07-27 Corinna Vinschen + + * 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 * Makefile.in: Build setmetamode.exe. 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)