diff options
author | Christopher Faylor <me@cgf.cx> | 2007-03-31 00:03:25 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2007-03-31 00:03:25 +0000 |
commit | c99e136f3d3fd8dc11432fad31dc1d990eff8061 (patch) | |
tree | c6d79290102c4ef94d23130e576d78a692542618 /winsup/utils/cygpath.cc | |
parent | e7fd6e57382a012d68036e25628ff3b0e2c613d2 (diff) | |
download | cygnal-c99e136f3d3fd8dc11432fad31dc1d990eff8061.tar.gz cygnal-c99e136f3d3fd8dc11432fad31dc1d990eff8061.tar.bz2 cygnal-c99e136f3d3fd8dc11432fad31dc1d990eff8061.zip |
* utils/cygpath.cc (get_long_path_name_w32impl): Close handles returned by
FindFirstFile.
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 9e4392f80..45fc9b405 100644 --- a/winsup/utils/cygpath.cc +++ b/winsup/utils/cygpath.cc @@ -1,5 +1,6 @@ /* cygpath.cc -- convert pathnames between Windows and Unix format - Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Red Hat, Inc. + Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, + 2006, 2007 Red Hat, Inc. This file is part of Cygwin. @@ -375,8 +376,13 @@ get_long_path_name_w32impl (LPCSTR src, LPSTR sbuf, DWORD) ptr[len] = 0; if (next[1] != ':' && strcmp(next, ".") && strcmp(next, "..")) { - if (FindFirstFile (buf2, &w32_fd) != INVALID_HANDLE_VALUE) + HANDLE h; + h = FindFirstFile (buf2, &w32_fd); + if (h != INVALID_HANDLE_VALUE) + { strcpy (ptr, w32_fd.cFileName); + FindClose (h); + } } ptr += strlen (ptr); if (pelem) @@ -415,7 +421,7 @@ get_long_name (const char *filename, DWORD& len) else if (err == ERROR_FILE_NOT_FOUND) len = get_long_path_name_w32impl (filename, buf, MAX_PATH); else - { + { buf[0] = '\0'; strncat (buf, filename, MAX_PATH - 1); len = strlen (buf); @@ -561,7 +567,7 @@ dowin (char option) prog_name, output_arg); exit (1); } - get_special_folder (buf, val); + get_special_folder (buf, val); } break; |