OSDN Git Service

* fhandler_disk_file.cc (fhandler_base::fstat_helper): Don't remove
authorcorinna <corinna>
Tue, 30 Oct 2007 12:32:15 +0000 (12:32 +0000)
committercorinna <corinna>
Tue, 30 Oct 2007 12:32:15 +0000 (12:32 +0000)
write bits for directories with R/O attribute.
(fhandler_base::fhaccess): Don't shortcircuit R/O attribute with W_OK
scenarios for directories.

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

index ea5d69a..3fa4f11 100644 (file)
@@ -1,3 +1,10 @@
+2007-10-30  Corinna Vinschen  <corinna@vinschen.de>
+
+       * fhandler_disk_file.cc (fhandler_base::fstat_helper): Don't remove
+       write bits for directories with R/O attribute.
+       (fhandler_base::fhaccess): Don't shortcircuit R/O attribute with W_OK
+       scenarios for directories.
+
 2007-10-22  Corinna Vinschen  <corinna@vinschen.de>
 
        * cygheap.h (struct cwdstuff): Drop hash member.  Drop get_hash,
index 1306078..bc30a39 100644 (file)
@@ -376,7 +376,8 @@ fhandler_base::fhaccess (int flags)
 
   if (is_fs_special ())
     /* short circuit */;
-  else if (has_attribute (FILE_ATTRIBUTE_READONLY) && (flags & W_OK))
+  else if (has_attribute (FILE_ATTRIBUTE_READONLY) && (flags & W_OK)
+          && !pc.isdir ())
     goto eaccess_done;
   else if (has_acls () && allow_ntsec)
     {
index 3ce09f0..81b274f 100644 (file)
@@ -535,7 +535,7 @@ fhandler_base::fstat_helper (struct __stat64 *buf,
     {
       /* If read-only attribute is set, modify ntsec return value */
       if (::has_attribute (dwFileAttributes, FILE_ATTRIBUTE_READONLY)
-         && !pc.issymlink ())
+         && !pc.isdir () && !pc.issymlink ())
        buf->st_mode &= ~(S_IWUSR | S_IWGRP | S_IWOTH);
 
       if (buf->st_mode & S_IFMT)
@@ -554,7 +554,7 @@ fhandler_base::fstat_helper (struct __stat64 *buf,
       buf->st_mode |= STD_RBITS;
 
       if (!::has_attribute (dwFileAttributes, FILE_ATTRIBUTE_READONLY)
-         && !pc.issymlink ())
+         && !pc.isdir () && !pc.issymlink ())
        buf->st_mode |= STD_WBITS;
       /* | S_IWGRP | S_IWOTH; we don't give write to group etc */