]> sourceware.org Git - newlib-cygwin.git/commitdiff
* fhandler_disk_file.cc (fhandler_base::fstat_helper): Fix inode number
authorCorinna Vinschen <corinna@vinschen.de>
Wed, 21 Dec 2005 13:01:27 +0000 (13:01 +0000)
committerCorinna Vinschen <corinna@vinschen.de>
Wed, 21 Dec 2005 13:01:27 +0000 (13:01 +0000)
debug output.
(fhandler_disk_file::fchown): Always set sensible permission values
when creating the ACL for symlinks.

winsup/cygwin/ChangeLog
winsup/cygwin/fhandler_disk_file.cc

index aa6cd5a650f55e4474a7224d1bda55064460da27..256788da64bf754e630ba676fd8b9c5229a8ced3 100644 (file)
@@ -1,3 +1,10 @@
+2005-12-21  Corinna Vinschen  <corinna@vinschen.de>
+
+       * 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.
+
 2005-12-20  Corinna Vinschen  <corinna@vinschen.de>
 
        * winsup.h (flush_file_buffers): Define as inline function.
index 5b684e5e7e1d96ff6a95bd54ad4242a1952cf1f6..d8fc42b42c165fc350f7444e58c5fdc09caf49f3 100644 (file)
@@ -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 ();
 
This page took 0.043701 seconds and 5 git commands to generate.