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:
authorChristopher Faylor <me@cgf.cx>2007-03-31 04:03:25 +0400
committerChristopher Faylor <me@cgf.cx>2007-03-31 04:03:25 +0400
commitc99e136f3d3fd8dc11432fad31dc1d990eff8061 (patch)
treec6d79290102c4ef94d23130e576d78a692542618
parente7fd6e57382a012d68036e25628ff3b0e2c613d2 (diff)
* utils/cygpath.cc (get_long_path_name_w32impl): Close handles returned by
FindFirstFile.
-rw-r--r--winsup/utils/ChangeLog5
-rw-r--r--winsup/utils/cygpath.cc14
2 files changed, 15 insertions, 4 deletions
diff --git a/winsup/utils/ChangeLog b/winsup/utils/ChangeLog
index 8407fb304..c690337e1 100644
--- a/winsup/utils/ChangeLog
+++ b/winsup/utils/ChangeLog
@@ -1,3 +1,8 @@
+2007-03-30 Mark Mitchell <mark@codesourcery.com>
+
+ * utils/cygpath.cc (get_long_path_name_w32impl): Close handles returned
+ by FindFirstFile.
+
2007-03-30 Christopher Faylor <me@cgf.cx>
* mount.cc (main): Turn dos file warnings off since we know what we're
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;