summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKen Brown <kbrown@cornell.edu>2019-12-09 07:27:18 -0500
committerKen Brown <kbrown@cornell.edu>2019-12-09 07:43:44 -0500
commit48fbe173f403c853e7f9fef128b0228f472e715d (patch)
treec0057be86e3161748469865035bc8aa36d56e18e
parent7a526cdc28a3c4acce98e8a99b06562452c90d07 (diff)
downloadcygnal-48fbe173f403c853e7f9fef128b0228f472e715d.tar.gz
cygnal-48fbe173f403c853e7f9fef128b0228f472e715d.tar.bz2
cygnal-48fbe173f403c853e7f9fef128b0228f472e715d.zip
Cygwin: symlink_info::check: avoid assertion failure
On certain error conditions there is a code snippet that checks whether the last component of the path has a trailing dot or space or a leading space. Skip this check if the last component is empty, i.e., if the path ends with a backslash. This avoids an assertion failure if the trailing backslash is the only backslash in the path, as is the case for a DOS drive 'X:\'. Addresses: https://cygwin.com/ml/cygwin/2019-12/msg00016.html
-rw-r--r--winsup/cygwin/path.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index f61003578..b5efd61b2 100644
--- a/winsup/cygwin/path.cc
+++ b/winsup/cygwin/path.cc
@@ -2895,7 +2895,8 @@ restart:
slow down normal operation. This extra check only kicks in if
we encountered a STATUS_OBJECT_NAME_NOT_FOUND *and* we didn't
already attach a suffix. */
- if (!restarted && !*ext_here && !(mount_flags & MOUNT_DOS))
+ if (!restarted && !*ext_here && ext_here[-1] != '\\'
+ && !(mount_flags & MOUNT_DOS))
{
/* Check for trailing dot or space or leading space in
last component. */