]> sourceware.org Git - newlib-cygwin.git/commitdiff
Cygwin: try_to_bin: fix rootdir handle after reopening
authorCorinna Vinschen <corinna@vinschen.de>
Wed, 9 Jan 2019 20:41:48 +0000 (21:41 +0100)
committerCorinna Vinschen <corinna@vinschen.de>
Wed, 9 Jan 2019 20:48:43 +0000 (21:48 +0100)
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>
winsup/cygwin/syscalls.cc

index 4f91f4b48a2b2de496c7be514a416cb4c2f3c15b..728a6b1e5231ccf0fdb21c57d4605fe2a04781a5 100644 (file)
@@ -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. */
This page took 0.036608 seconds and 5 git commands to generate.