[AC21.4] Fix handling of the read-only attribute bit

Vin Shelton acs at xemacs.org
Mon Jan 1 20:31:01 EST 2007


APPROVE COMMIT 21.4.

Thanks for the patch, Benson.  I've applied it to the 21.4 branch; it
will appear in XEmacs 21.4.21.

(The patch as originally posted was malformed - I've included it here
for reference.)

Index: src/ChangeLog
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/ChangeLog,v
retrieving revision 1.290.2.116
diff -a -u -u -0 -r1.290.2.116 ChangeLog
--- src/ChangeLog	2006/12/10 00:14:52	1.290.2.116
+++ src/ChangeLog	2007/01/02 00:16:10
@@ -0,0 +1,7 @@
+2006-12-25  Benson I. Margulies  <benson at dchbk.us>
+
+	* src/fileio.c (check_writable): 
+        Cope with the fact that the read-only attribute trumps Windows NTFS
+        ACLS.
+
+
Index: src/fileio.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/fileio.c,v
retrieving revision 1.66.2.8
diff -a -u -r1.66.2.8 fileio.c
--- src/fileio.c	2006/11/20 18:20:22	1.66.2.8
+++ src/fileio.c	2007/01/02 00:16:19
@@ -2307,13 +2307,17 @@
   filename = filename_buffer;
 #endif
 
+  // ask simple question first
+  attributes = GetFileAttributes(filename);
+  if (0 != (attributes & FILE_ATTRIBUTE_READONLY))
+      return 0;
+
   /* Win32 prototype lacks const. */
   error = GetNamedSecurityInfo((LPTSTR)filename, SE_FILE_OBJECT, 
                                DACL_SECURITY_INFORMATION|GROUP_SECURITY_INFORMATION|OWNER_SECURITY_INFORMATION,
                                &psidOwner, &psidGroup, &pDacl, &pSacl, &pDesc);
   if (error != ERROR_SUCCESS) { // FAT?
-    attributes = GetFileAttributes(filename);
-    return (attributes & FILE_ATTRIBUTE_DIRECTORY) || (0 == (attributes & FILE_ATTRIBUTE_READONLY));
+      return 1;
   }
 
   genericMapping.GenericRead = FILE_GENERIC_READ;


Regards,
  Vin



More information about the XEmacs-Patches mailing list