diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2008-05-20 20:24:06 +0400 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2008-05-20 20:24:06 +0400 |
commit | ec0165f29cb3d6cce27fc4196d67fd86d2c1cbf1 (patch) | |
tree | 43978c57939303467e37d00eed4428820ce07231 /winsup/cygwin/fhandler_disk_file.cc | |
parent | 316d9cabfeffc7e42cc0d12cdb4ea97cffc2641a (diff) |
* fhandler_disk_file.cc (fhandler_disk_file::mkdir): Create directories
on NFS shares with correct mode bits.
Diffstat (limited to 'winsup/cygwin/fhandler_disk_file.cc')
-rw-r--r-- | winsup/cygwin/fhandler_disk_file.cc | 23 |
1 files changed, 22 insertions, 1 deletions
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); |