From da92b8fc3beb3aeedd9d30c6d29681ed9c48f6da Mon Sep 17 00:00:00 2001 From: Ray Donnelly Date: Sun, 31 Jan 2016 21:06:12 +0000 Subject: [PATCH] Don't remove trailing slash from root ('/') Fixes problem reported on the Cygwin mailing list at: https://www.cygwin.com/ml/cygwin/2016-01/msg00480.html * path.cc (path_conv:check): need_directory = 1 when single slash Signed-off-by: Ray Donnelly --- winsup/cygwin/path.cc | 6 ++++++ 1 file changed, 6 insertions(+) mode change 100644 => 100755 winsup/cygwin/path.cc diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc old mode 100644 new mode 100755 index e49f180..5087adf --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -733,6 +733,12 @@ path_conv::check (const char *src, unsigned opt, need_directory = 1; *--tail = '\0'; } + /* Special case for "/" must set need_directory, without removing + trailing slash */ + else if (tail == path_copy + 1 && isslash (tail[-1])) + { + need_directory = 1; + } path_end = tail; /* Scan path_copy from right to left looking either for a symlink -- 2.5.3