From 563dda82591bddb213f1771a63de534e11602cd8 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 13 Dec 2016 12:48:05 +0100 Subject: Fix incorrect path conversion on non-existent files on network shares NtOpenFile/NtCreateFile on non-existent paths on network drives has a bug. Assuming a path Z:\dir\file. Further assuming that Z:\dir does not exist. The first NtOpenFile("Z:\dir\file") correctly returns STATUS_OBJECT_PATH_NOT_FOUND. Subsequent calls incorrectly return STATUS_OBJECT_NAME_NOT_FOUND. This appears to be some kind of caching behaviour. Waiting a while before repeating the call correctly returns STATUS_OBJECT_PATH_NOT_FOUND again. This patch works around the observed misbehaviour. Signed-off-by: Corinna Vinschen --- winsup/cygwin/path.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index c6f7c1d27..c3b304ab5 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -2810,6 +2810,13 @@ restart: || status == STATUS_NO_MEDIA_IN_DEVICE) { set_error (ENOENT); + if (ext_tacked_on && !had_ext) + { + *ext_here = '\0'; + ext_tacked_on = false; + ext_here = NULL; + extn = 0; + } goto file_not_symlink; } if (status != STATUS_OBJECT_NAME_NOT_FOUND -- cgit v1.2.3