From 8d30d47ae6bca6b8ab4da6df62616ab9521a48d1 Mon Sep 17 00:00:00 2001
From: Ray Donnelly <mingw.android@gmail.com>
Date: Thu, 19 Dec 2013 19:04:15 +0000
Subject: [PATCH 3/3] * winsup/cygwin/path.cc (path_conv::check): Reattach
 trailing dirsep on existing directories too (previously this would only
 happen to non-existing ones).

---
 winsup/cygwin/path.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index 047810f..24e2c01 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -1075,7 +1075,7 @@ out:
     }
   else if (!need_directory || error)
     /* nothing to do */;
-  else if (fileattr == INVALID_FILE_ATTRIBUTES)
+  else if (fileattr == INVALID_FILE_ATTRIBUTES || ((fileattr & FILE_ATTRIBUTE_DIRECTORY) && !component))
     strcat (modifiable_path (), "\\"); /* Reattach trailing dirsep in native path. */
   else if (fileattr & FILE_ATTRIBUTE_DIRECTORY)
     path_flags &= ~PATH_SYMLINK;
-- 
1.8.5.2

