This is the mail archive of the cygwin-patches@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

fhandler.cc patch


Hi,

this is the small patch that solves a problem when get_file_attribute
returns write permissions while FILE_ATTRIBUTE_READONLY is set.
The patch removes the write bits from st_mode in this case.

Corinna
Index: fhandler.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/fhandler.cc,v
retrieving revision 1.1.1.1
diff -u -p -u -p -r1.1.1.1 fhandler.cc
--- fhandler.cc	2000/02/17 19:38:31	1.1.1.1
+++ fhandler.cc	2000/02/20 22:55:14
@@ -950,6 +950,10 @@ fhandler_disk_file::fstat (struct stat *
     buf->st_mode |= S_IFDIR;
   if (! get_file_attribute (has_acls (), get_win32_name (), &buf->st_mode))
     {
+      /* If read-only attribute is set, modify ntsec return value */
+      if (local.dwFileAttributes & FILE_ATTRIBUTE_READONLY)
+	buf->st_mode &= ~(S_IWUSR | S_IWGRP | S_IWOTH);
+
       buf->st_mode &= ~S_IFMT;
       if (get_symlink_p ())
 	buf->st_mode |= S_IFLNK;
Index: ChangeLog
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/ChangeLog,v
retrieving revision 1.1.1.1
diff -u -p -u -p -r1.1.1.1 ChangeLog
--- ChangeLog	2000/02/17 19:38:31	1.1.1.1
+++ ChangeLog	2000/02/20 22:55:14
@@ -1,3 +1,8 @@
+Sun Feb 18 21:31:00 2000  Corinna Vinschen <corinna@vinschen.de>
+
+        * fhandler.cc (fhandler_disk_file::fstat): Modify get_file_attribute
+        return value if FILE_ATTRIBUTE_READONLY is set.
+
 Mon Feb  7 16:50:44 2000  Christopher Faylor <cgf@cygnus.com>
 
 	* Makefile.in: cygrun needs libshell32.a.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]