[AC21.5] Support readonly bit under Windows

Vin Shelton acs at alumni.princeton.edu
Mon Jan 8 08:34:37 EST 2007


APPROVE COMMIT 21.5

On 1/6/07, Vin Shelton <acs at xemacs.org> wrote:
> This is the 21.5 version of the readonly-bit patch that Benson posted
> for 21.4.
>
>
> src/ChangeLog addition:
>
> 2007-01-06  Vin Shelton  <acs at xemacs.org>
>
>         * fileio.c (check_writable): Check old-style readonly bit first.
>
>
> 21.5 source patch:
> Diff command:   cvs -q diff -u
> Files affected: src/fileio.c
>
> Index: src/fileio.c
> ===================================================================
> RCS file: /pack/xemacscvs/XEmacs/xemacs/src/fileio.c,v
> retrieving revision 1.109
> diff -a -u -u -r1.109 fileio.c
> --- src/fileio.c        2006/12/08 02:22:01     1.109
> +++ src/fileio.c        2007/01/07 02:42:39
> @@ -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));
>         }
>
>
> _______________________________________________
> XEmacs-Patches mailing list
> XEmacs-Patches at xemacs.org
> http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches
>


-- 
The Journey by Mary Oliver
http://www.poemhunter.com/p/m/poem.asp?poet=6771&poem=30506



More information about the XEmacs-Patches mailing list