Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYoshinao Muramatsu <ysno@ac.auone-net.jp>2023-03-20 14:51:01 +0300
committerCorinna Vinschen <corinna@vinschen.de>2023-03-21 20:56:52 +0300
commit7666e248dd08ba96c12748fc4781388f57671ae5 (patch)
tree8384a500366f55f2d5b2386351f86c2cc467c0cb /winsup/cygwin/syscalls.cc
parent527dd1b407e7d74037a19aed6e25aa36578da2f7 (diff)
Cygwin: fix rename in container
Renaming files returns STATUS_INVALID_PARAMETE on a bind mounted file system in hyper-v container with FILE_RENAME_POSIX_SEMANTICS. Disable the use_posix_semantics flag and retry. Signed-off-by: Yoshinao Muramatsu <ysno@ac.auone-net.jp>
Diffstat (limited to 'winsup/cygwin/syscalls.cc')
-rw-r--r--winsup/cygwin/syscalls.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index 4e278808a..4843502c6 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -2419,6 +2419,7 @@ rename2 (const char *oldpath, const char *newpath, unsigned int at2flags)
&& oldpc.fs_is_ntfs ()
&& oldpc.has_attribute (FILE_SUPPORTS_OPEN_BY_FILE_ID);
+ignore_posix_semantics_retry:
/* Opening the file must be part of the transaction. It's not sufficient
to call only NtSetInformationFile under the transaction. Therefore we
have to start the transaction here, if necessary. Don't start
@@ -2663,6 +2664,15 @@ skip_pre_W10_checks:
unlink_nt (*removepc, false);
res = 0;
}
+ else if (use_posix_semantics && status == STATUS_INVALID_PARAMETER)
+ {
+ /* NtSetInformationFile returns STATUS_INVALID_PARAMETER
+ on a bind mounted file system in hyper-v container
+ with FILE_RENAME_POSIX_SEMANTICS.
+ Disable the use_posix semntics flag and retry. */
+ use_posix_semantics = 0;
+ goto ignore_posix_semantics_retry;
+ }
else
__seterrno_from_nt_status (status);
}