apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject cvs commit: apr/include apr_file_io.h
Date Mon, 11 Feb 2002 21:03:44 GMT
brane       02/02/11 13:03:44

  Modified:    file_io/os2 filestat.c
               file_io/unix filestat.c
               file_io/win32 filestat.c
               include  apr_file_io.h
  Log:
  apr_file_attrs_set takes a new parameter, attr_mask, that defines which
  bits in the attributes are valid.
  
  Changed Unix, OS/2 and Win32 implementation to match.
  
  Revision  Changes    Path
  1.27      +8 -4      apr/file_io/os2/filestat.c
  
  Index: filestat.c
  ===================================================================
  RCS file: /home/cvs/apr/file_io/os2/filestat.c,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- filestat.c	2 Feb 2002 06:12:34 -0000	1.26
  +++ filestat.c	11 Feb 2002 21:03:44 -0000	1.27
  @@ -202,6 +202,7 @@
   
   APR_DECLARE(apr_status_t) apr_file_attrs_set(const char *fname,
                                                apr_fileattrs_t attributes,
  +                                             apr_fileattrs_t attr_mask,
                                                apr_pool_t *cont)
   {
       FILESTATUS3 fs3;
  @@ -210,10 +211,13 @@
       if (rc == 0) {
           ULONG old_attr = fs3.attrFile;
   
  -        if (attributes & APR_FILE_ATTR_READONLY) {
  -            fs3.attrFile |= FILE_READONLY;
  -        } else {
  -            fs3.attrFile &= ~FILE_READONLY;
  +        if (attr_mask & APR_FILE_ATTR_READONLY)
  +        {
  +            if (attributes & APR_FILE_ATTR_READONLY) {
  +                fs3.attrFile |= FILE_READONLY;
  +            } else {
  +                fs3.attrFile &= ~FILE_READONLY;
  +            }
           }
   
           if (fs3.attrFile != old_attr) {
  
  
  
  1.50      +35 -11    apr/file_io/unix/filestat.c
  
  Index: filestat.c
  ===================================================================
  RCS file: /home/cvs/apr/file_io/unix/filestat.c,v
  retrieving revision 1.49
  retrieving revision 1.50
  diff -u -r1.49 -r1.50
  --- filestat.c	1 Feb 2002 01:40:38 -0000	1.49
  +++ filestat.c	11 Feb 2002 21:03:44 -0000	1.50
  @@ -138,6 +138,7 @@
   
   APR_DECLARE(apr_status_t) apr_file_attrs_set(const char *fname,
                                                apr_fileattrs_t attributes,
  +                                             apr_fileattrs_t attr_mask,
                                                apr_pool_t *cont)
   {
       apr_status_t status;
  @@ -147,21 +148,44 @@
       if (!APR_STATUS_IS_SUCCESS(status))
           return status;
   
  -    if (attributes & APR_FILE_ATTR_READONLY) {
  -        finfo.protection &= ~APR_UWRITE;
  -        finfo.protection &= ~APR_GWRITE;
  -        finfo.protection &= ~APR_WWRITE;
  +    /* ### TODO: should added bits be umask'd? */
  +    if (attr_mask & APR_FILE_ATTR_READONLY)
  +    {
  +        if (attributes & APR_FILE_ATTR_READONLY)
  +        {
  +            finfo.protection &= ~APR_UWRITE;
  +            finfo.protection &= ~APR_GWRITE;
  +            finfo.protection &= ~APR_WWRITE;
  +        }
  +        else
  +        {
  +            /* ### umask this! */
  +            finfo.protection |= APR_UWRITE;
  +            finfo.protection |= APR_GWRITE;
  +            finfo.protection |= APR_WWRITE;
  +        }
       }
  -    if (attributes & APR_FILE_ATTR_EXECUTABLE) {
  -        /* ### TODO: should this be umask'd? */
  -        finfo.protection |= APR_UEXECUTE;
  -        finfo.protection |= APR_GEXECUTE;
  -        finfo.protection |= APR_WEXECUTE;
  +
  +    if (attr_mask & APR_FILE_ATTR_EXECUTABLE)
  +    {
  +        if (attributes & APR_FILE_ATTR_EXECUTABLE)
  +        {
  +            /* ### umask this! */
  +            finfo.protection |= APR_UEXECUTE;
  +            finfo.protection |= APR_GEXECUTE;
  +            finfo.protection |= APR_WEXECUTE;
  +        }
  +        else
  +        {
  +            finfo.protection &= ~APR_UEXECUTE;
  +            finfo.protection &= ~APR_GEXECUTE;
  +            finfo.protection &= ~APR_WEXECUTE;
  +        }
       }
   
  -   return apr_file_perms_set(fname, finfo.protection);
  +    return apr_file_perms_set(fname, finfo.protection);
   }
  -                                                  
  +
   APR_DECLARE(apr_status_t) apr_stat(apr_finfo_t *finfo, 
                                      const char *fname, 
                                      apr_int32_t wanted, apr_pool_t *cont)
  
  
  
  1.65      +8 -4      apr/file_io/win32/filestat.c
  
  Index: filestat.c
  ===================================================================
  RCS file: /home/cvs/apr/file_io/win32/filestat.c,v
  retrieving revision 1.64
  retrieving revision 1.65
  diff -u -r1.64 -r1.65
  --- filestat.c	10 Feb 2002 22:36:41 -0000	1.64
  +++ filestat.c	11 Feb 2002 21:03:44 -0000	1.65
  @@ -620,6 +620,7 @@
   
   APR_DECLARE(apr_status_t) apr_file_attrs_set(const char *fname,
                                                apr_fileattrs_t attributes,
  +                                             apr_fileattrs_t attr_mask,
                                                apr_pool_t *cont)
   {
       DWORD flags;
  @@ -648,10 +649,13 @@
       if (flags == 0xFFFFFFFF)
           return apr_get_os_error();
   
  -    if (attributes & APR_FILE_ATTR_READONLY)
  -        flags |= FILE_ATTRIBUTE_READONLY;
  -    else
  -        flags &= !FILE_ATTRIBUTE_READONLY;
  +    if (attr_mask & APR_FILE_ATTR_READONLY)
  +    {
  +        if (attributes & APR_FILE_ATTR_READONLY)
  +            flags |= FILE_ATTRIBUTE_READONLY;
  +        else
  +            flags &= ~FILE_ATTRIBUTE_READONLY;
  +    }
   
   #if APR_HAS_UNICODE_FS
       IF_WIN_OS_IS_UNICODE
  
  
  
  1.118     +3 -1      apr/include/apr_file_io.h
  
  Index: apr_file_io.h
  ===================================================================
  RCS file: /home/cvs/apr/include/apr_file_io.h,v
  retrieving revision 1.117
  retrieving revision 1.118
  diff -u -r1.117 -r1.118
  --- apr_file_io.h	1 Feb 2002 01:40:38 -0000	1.117
  +++ apr_file_io.h	11 Feb 2002 21:03:44 -0000	1.118
  @@ -126,7 +126,7 @@
   /** @} */
   
   /** File attributes */
  -typedef apr_int32_t apr_fileattrs_t;
  +typedef apr_uint32_t apr_fileattrs_t;
   
   /** should be same as whence type in lseek, POSIX defines this as int */
   typedef int       apr_seek_where_t;
  @@ -583,6 +583,7 @@
    *            APR_FILE_ATTR_READONLY   - make the file readonly
    *            APR_FILE_ATTR_EXECUTABLE - make the file executable
    * </PRE>
  + * @param attr_mask Mask of valid bits in attributes.
    * @param cont the pool to use.
    * @remark This function should be used in preference to explict manipulation
    *      of the file permissions, because the operations to provide these
  @@ -593,6 +594,7 @@
    */
   APR_DECLARE(apr_status_t) apr_file_attrs_set(const char *fname,
                                                apr_fileattrs_t attributes,
  +                                             apr_fileattrs_t attr_mask,
                                                apr_pool_t *cont);
   
   /**
  
  
  

Mime
View raw message