Repair for 21.4 and the read-only attribute

Benson Margulies bim2006 at basistech.com
Mon Dec 25 09:31:19 EST 2006


To: xemacs-patches at xemacs.org
Subject: [PATCH] Fix handling of the read-only attribute bit
X-Generated-By: Patcher version 3.8
--text follows this line--



src/ChangeLog addition:

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.


XEmacs21-4 source patch:
Diff command:   cvs -q diff -u
Files affected: src/fileio.c
===================================================================
RCS

cvs server: nt/xemacs.sln is a new entry, no comparison available
cvs server: nt/xemacs.vcproj is a new entry, no comparison available
Index: src/fileio.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/fileio.c,v
retrieving revision 1.66.2.8
diff -u -r1.66.2.8 fileio.c
--- src/fileio.c	2006/11/20 18:20:22	1.66.2.8
+++ src/fileio.c	2006/12/25 14:21:36
@@ -2307,13 +2307,18 @@
   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_INFO
RMATION,
                                &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;



More information about the XEmacs-Patches mailing list