* syscalls.cc (rename): Open file with FILE_READ_ATTRIBUTES.

This commit is contained in:
Corinna Vinschen 2010-08-25 08:51:41 +00:00
parent 58ae62fd94
commit df70da7f6c
2 changed files with 11 additions and 4 deletions

View File

@ -1,3 +1,7 @@
2010-08-25 Corinna Vinschen <corinna@vinschen.de>
* syscalls.cc (rename): Open file with FILE_READ_ATTRIBUTES.
2010-08-24 Corinna Vinschen <corinna@vinschen.de>
* include/cygwin/version.h: Fix comment.

View File

@ -2010,10 +2010,13 @@ rename (const char *oldpath, const char *newpath)
start_transaction (old_trans, trans);
retry:
/* DELETE is required to rename a file. Samba (only some versions?) doesn't
like the FILE_SHARE_DELETE mode if the file has the R/O attribute set
and returns STATUS_ACCESS_DENIED in that case. */
status = NtOpenFile (&fh, DELETE, oldpc.get_object_attr (attr, sec_none_nih),
/* DELETE is required to rename a file. At least one cifs FS (Tru64) needs
FILE_READ_ATTRIBUTE, otherwise the FileRenameInformation call fails with
STATUS_ACCESS_DENIED. Samba (only some versions?) doesn't like the
FILE_SHARE_DELETE mode if the file has the R/O attribute set and returns
STATUS_ACCESS_DENIED in that case. */
status = NtOpenFile (&fh, DELETE | FILE_READ_ATTRIBUTES,
oldpc.get_object_attr (attr, sec_none_nih),
&io,
oldpc.fs_is_samba () ? FILE_SHARE_READ | FILE_SHARE_WRITE
: FILE_SHARE_VALID_FLAGS,