CVS update by vins xemacs/src ...

xemacs-cvs at xemacs.org xemacs-cvs at xemacs.org
Mon Jan 8 08:33:47 EST 2007


  User: vins    
  Date: 07/01/08 14:33:47

  Modified:    xemacs/src ChangeLog fileio.c
Log:
On Windows, check read-only bit first.

Revision  Changes    Path
1.1038    +4 -0      XEmacs/xemacs/src/ChangeLog

Index: ChangeLog
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/ChangeLog,v
retrieving revision 1.1037
retrieving revision 1.1038
diff -u -p -r1.1037 -r1.1038
--- ChangeLog	2006/12/29 18:09:50	1.1037
+++ ChangeLog	2007/01/08 13:33:42	1.1038
@@ -1,3 +1,7 @@
+2007-01-06  Vin Shelton  <acs at xemacs.org>
+
+	* fileio.c (check_writable): Check old-style readonly bit first.
+
 2006-12-21  Aidan Kehoe  <kehoea at parhasard.net>
 
 	* file-coding.c:



1.110     +11 -5     XEmacs/xemacs/src/fileio.c

Index: fileio.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/fileio.c,v
retrieving revision 1.109
retrieving revision 1.110
diff -u -p -r1.109 -r1.110
--- fileio.c	2006/12/08 02:22:01	1.109
+++ fileio.c	2007/01/08 13:33:43	1.110
@@ -2311,8 +2311,8 @@ check_writable (const Ibyte *filename)
 	PRIVILEGE_SET PrivilegeSet;
     DWORD dwPrivSetSize = sizeof( PRIVILEGE_SET );
     BOOL fAccessGranted = FALSE;
-	DWORD dwAccessAllowed;
-  Extbyte *fnameext;
+    DWORD dwAccessAllowed;
+    Extbyte *fnameext;
 
 #ifdef CYGWIN
     cygwin_conv_to_full_win32_path(filename, filename_buffer);
@@ -2320,12 +2320,18 @@ check_writable (const Ibyte *filename)
 #endif
 
     C_STRING_TO_TSTR(filename, fnameext);
+
+    // First check for a normal file with the old-style readonly bit
+    attributes = qxeGetFileAttributes(fnameext);
+    if (FILE_ATTRIBUTE_READONLY == (attributes & (FILE_ATTRIBUTE_DIRECTORY|FILE_ATTRIBUTE_READONLY)))
+      return 0;
+
 	/* Win32 prototype lacks const. */
 	error = qxeGetNamedSecurityInfo(fnameext, SE_FILE_OBJECT, 
-		DACL_SECURITY_INFORMATION|GROUP_SECURITY_INFORMATION|OWNER_SECURITY_INFORMATION,
-		&psidOwner, &psidGroup, &pDacl, &pSacl, &pDesc);
+                                    DACL_SECURITY_INFORMATION|GROUP_SECURITY_INFORMATION|OWNER_SECURITY_INFORMATION,
+                                    &psidOwner, &psidGroup, &pDacl, &pSacl, &pDesc);
 	if(error != ERROR_SUCCESS) { // FAT?
-		attributes = qxeGetFileAttributes((Extbyte *)filename);
+		attributes = qxeGetFileAttributes(fnameext);
 		return (attributes & FILE_ATTRIBUTE_DIRECTORY) || (0 == (attributes & FILE_ATTRIBUTE_READONLY));
 	}
 





More information about the XEmacs-CVS mailing list