This is the mail archive of the cygwin-cvs@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[newlib-cygwin] Fix incorrect path conversion on non-existent files on network shares


https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=563dda82591bddb213f1771a63de534e11602cd8

commit 563dda82591bddb213f1771a63de534e11602cd8
Author: Corinna Vinschen <corinna@vinschen.de>
Date:   Tue Dec 13 12:48:05 2016 +0100

    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 <corinna@vinschen.de>

Diff:
---
 winsup/cygwin/path.cc | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc
index c6f7c1d..c3b304a 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]