# HG changeset patch # User vins # Date 1168263223 0 # Node ID a257e03c580e10c71775a22a8a340eee65135223 # Parent 48cade988b6742a5ba3f734b4be06100b861713b [xemacs-hg @ 2007-01-08 13:33:42 by vins] On Windows, check read-only bit first. diff -r 48cade988b67 -r a257e03c580e src/ChangeLog --- a/src/ChangeLog Sun Jan 07 22:51:08 2007 +0000 +++ b/src/ChangeLog Mon Jan 08 13:33:43 2007 +0000 @@ -1,3 +1,7 @@ +2007-01-06 Vin Shelton + + * fileio.c (check_writable): Check old-style readonly bit first. + 2006-12-21 Aidan Kehoe * file-coding.c: diff -r 48cade988b67 -r a257e03c580e src/fileio.c --- a/src/fileio.c Sun Jan 07 22:51:08 2007 +0000 +++ b/src/fileio.c Mon Jan 08 13:33:43 2007 +0000 @@ -2311,8 +2311,8 @@ 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 @@ #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)); }