diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2008-05-20 16:24:06 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2008-05-20 16:24:06 +0000 |
commit | ec0165f29cb3d6cce27fc4196d67fd86d2c1cbf1 (patch) | |
tree | 43978c57939303467e37d00eed4428820ce07231 /winsup/cygwin | |
parent | 316d9cabfeffc7e42cc0d12cdb4ea97cffc2641a (diff) | |
download | newlib-ec0165f29cb3d6cce27fc4196d67fd86d2c1cbf1.zip newlib-ec0165f29cb3d6cce27fc4196d67fd86d2c1cbf1.tar.gz newlib-ec0165f29cb3d6cce27fc4196d67fd86d2c1cbf1.tar.bz2 |
* fhandler_disk_file.cc (fhandler_disk_file::mkdir): Create directories
on NFS shares with correct mode bits.
Diffstat (limited to 'winsup/cygwin')
-rw-r--r-- | winsup/cygwin/ChangeLog | 5 | ||||
-rw-r--r-- | winsup/cygwin/fhandler_disk_file.cc | 23 |
2 files changed, 27 insertions, 1 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index bd47509..023018f 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 17e1d55..f51da19 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); |