From 60d92c8d5facc2c2d8f336007edfb5b1a09eed11 Mon Sep 17 00:00:00 2001
From: Christoph Reiter <reiter.christoph@gmail.com>
Date: Sun, 9 Aug 2020 13:43:50 +0200
Subject: [PATCH 26/N] recursiveCopy: Always close the used handle with
 FindClose()

See https://github.com/msys2/MSYS2-packages/issues/2060
---
 winsup/cygwin/path.cc | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 4c5595d..561d1ac 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -1677,7 +1677,7 @@ static int
 recursiveCopy (char * src, char * dst, const char * origpath)
 {
   WIN32_FIND_DATA dHfile;
-  HANDLE dH;
+  HANDLE dH = INVALID_HANDLE_VALUE;
   BOOL findfiles;
   int srcpos = strlen (src);
   int dstpos = strlen (dst);
@@ -1747,6 +1747,9 @@ recursiveCopy (char * src, char * dst, const char * origpath)
 
 done:
 
+  if (dH != INVALID_HANDLE_VALUE)
+    FindClose (dH);
+
   return res;
 }
 
-- 
2.31.1

