public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Cygwin: try_to_bin: fix rootdir handle after reopening
@ 2019-01-09 20:49 Corinna Vinschen
  0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2019-01-09 20:49 UTC (permalink / raw)
  To: cygwin-cvs

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

commit b7a6d357ee23d690a6559235600b85801d6ad025
Author: Corinna Vinschen <corinna@vinschen.de>
Date:   Wed Jan 9 21:41:48 2019 +0100

    Cygwin: try_to_bin: fix rootdir handle after reopening
    
    If the first rename fails, we reopen the rootdir for creating a subdir.
    The rootdir handle can change its value at this point, but the code
    doesn't take this into account.  The subsequent rename then fails with
    STATUS_INVALID_HANDLE.  Fix this by copying the new rootdir value to
    pfri->RootDirectory.
    
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

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

diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index 4f91f4b..728a6b1 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -389,6 +389,8 @@ try_to_bin (path_conv &pc, HANDLE &fh, ACCESS_MASK access, ULONG flags)
 	  		&recycler, status);
 	  goto out;
 	}
+      /* Correct the rootdir HANDLE in pfri after reopening the dir. */
+      pfri->RootDirectory = rootdir;
       /* Then check if recycler exists by opening and potentially creating it.
 	 Yes, we can really do that.  Typically the recycle bin is created
 	 by the first user actually using the bin. */


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-01-09 20:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-09 20:49 [newlib-cygwin] Cygwin: try_to_bin: fix rootdir handle after reopening Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).