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:
authorCorinna Vinschen <corinna@vinschen.de>2005-12-21 16:01:27 +0300
committerCorinna Vinschen <corinna@vinschen.de>2005-12-21 16:01:27 +0300
commit0786c42a9ce31bfbd48b8887e509dab09a6974a0 (patch)
treedc5f22d6c5d75ffb31f3961fc97ba55b06de0303 /winsup/cygwin/fhandler_disk_file.cc
parent94692f408c6c668d09527a6cac6a88be747a2943 (diff)
* fhandler_disk_file.cc (fhandler_base::fstat_helper): Fix inode number
debug output. (fhandler_disk_file::fchown): Always set sensible permission values when creating the ACL for symlinks.
Diffstat (limited to 'winsup/cygwin/fhandler_disk_file.cc')
-rw-r--r--winsup/cygwin/fhandler_disk_file.cc24
1 files changed, 19 insertions, 5 deletions
diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc
index 5b684e5e7..d8fc42b42 100644
--- a/winsup/cygwin/fhandler_disk_file.cc
+++ b/winsup/cygwin/fhandler_disk_file.cc
@@ -452,9 +452,9 @@ fhandler_base::fstat_helper (struct __stat64 *buf,
}
done:
- syscall_printf ("0 = fstat (, %p) st_atime=%x st_size=%D, st_mode=%p, st_ino=%d, sizeof=%d",
+ syscall_printf ("0 = fstat (, %p) st_atime=%x st_size=%D, st_mode=%p, st_ino=%D, sizeof=%d",
buf, buf->st_atime, buf->st_size, buf->st_mode,
- (int) buf->st_ino, sizeof (*buf));
+ buf->st_ino, sizeof (*buf));
return 0;
}
@@ -562,9 +562,23 @@ fhandler_disk_file::fchown (__uid32_t uid, __gid32_t gid)
attrib |= S_IFDIR;
int res = get_file_attribute (pc.has_acls (), get_io_handle (), pc, &attrib);
if (!res)
- res = set_file_attribute (pc.has_acls (), get_io_handle (), pc,
- uid, gid, attrib);
-
+ {
+ /* Typical Windows default ACLs can contain permissions for one
+ group, while being owned by another user/group. The permission
+ bits returned above are pretty much useless then. Creating a
+ new ACL with these useless permissions results in a potentially
+ broken symlink. So what we do here is to set the underlying
+ permissions of symlinks to a sensible value which allows the
+ world to read the symlink and only the new owner to change it.
+ As for the execute permissions... they *seem* to be not
+ necessary, but for the sake of comleteness and to avoid
+ struggling with yet another Windows weirdness, the execute bits
+ are added as well. */
+ if (pc.issymlink ())
+ attrib = S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH;
+ res = set_file_attribute (pc.has_acls (), get_io_handle (), pc,
+ uid, gid, attrib);
+ }
if (oret)
close ();