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:
-rw-r--r--winsup/cygwin/ChangeLog5
-rw-r--r--winsup/cygwin/fhandler_disk_file.cc23
2 files changed, 27 insertions, 1 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index bd475091b..023018f29 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,10 @@
2008-05-20 Corinna Vinschen <corinna@vinschen.de>
+ * fhandler_disk_file.cc (fhandler_disk_file::mkdir): Create directories
+ on NFS shares with correct mode bits.
+
+2008-05-20 Corinna Vinschen <corinna@vinschen.de>
+
* winsup.h (cygwin_inet_addr): Fix type of declaration.
2008-05-20 Corinna Vinschen <corinna@vinschen.de>
diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc
index 17e1d55a3..f51da1948 100644
--- a/winsup/cygwin/fhandler_disk_file.cc
+++ b/winsup/cygwin/fhandler_disk_file.cc
@@ -1438,12 +1438,33 @@ fhandler_disk_file::mkdir (mode_t mode)
OBJECT_ATTRIBUTES attr;
IO_STATUS_BLOCK io;
ULONG fattr = FILE_ATTRIBUTE_DIRECTORY;
+ PFILE_FULL_EA_INFORMATION p = NULL;
+ ULONG plen = 0;
+
+ if (pc.fs_is_nfs ())
+ {
+ /* When creating a dir on an NFS share, we have to set the
+ file mode by writing a NFS fattr3 structure with the
+ correct mode bits set. */
+ plen = sizeof (FILE_FULL_EA_INFORMATION) + sizeof (NFS_V3_ATTR)
+ + sizeof (fattr3);
+ p = (PFILE_FULL_EA_INFORMATION) alloca (plen);
+ p->NextEntryOffset = 0;
+ p->Flags = 0;
+ p->EaNameLength = sizeof (NFS_V3_ATTR) - 1;
+ p->EaValueLength = sizeof (fattr3);
+ strcpy (p->EaName, NFS_V3_ATTR);
+ fattr3 *nfs_attr = (fattr3 *) (p->EaName + p->EaNameLength + 1);
+ memset (nfs_attr, 0, sizeof (fattr3));
+ nfs_attr->type = NF3DIR;
+ nfs_attr->mode = (mode & 07777) & ~cygheap->umask;
+ }
status = NtCreateFile (&dir, FILE_LIST_DIRECTORY | SYNCHRONIZE,
pc.get_object_attr (attr, sa), &io, NULL,
fattr, FILE_SHARE_VALID_FLAGS, FILE_CREATE,
FILE_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT
| FILE_OPEN_FOR_BACKUP_INTENT,
- NULL, 0);
+ p, plen);
if (NT_SUCCESS (status))
{
NtClose (dir);