apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject cvs commit: apr/file_io/win32 filestat.c
Date Wed, 24 Apr 2002 04:17:45 GMT
wrowe       02/04/23 21:17:45

  Modified:    file_io/win32 filestat.c
  Log:
    Half of a fix.  We were inappropriately using GetFileInformationEx and
    friends to attempt to get the details of a Junction (NTFS symlink.)
    This was entirely invalid, we now use the open->getfileinfo->close on
    such an entity.  The faster methods exist only within the NT kernel, an
    option I'll be exploring but haven't had time to address.
  
    Bugz report 8014, identified by Sam Morris <sam@netcity.co.uk>
  
  Revision  Changes    Path
  1.68      +20 -15    apr/file_io/win32/filestat.c
  
  Index: filestat.c
  ===================================================================
  RCS file: /home/cvs/apr/file_io/win32/filestat.c,v
  retrieving revision 1.67
  retrieving revision 1.68
  diff -u -r1.67 -r1.68
  --- filestat.c	20 Mar 2002 08:54:42 -0000	1.67
  +++ filestat.c	24 Apr 2002 04:17:44 -0000	1.68
  @@ -466,24 +466,29 @@
           return APR_ENAMETOOLONG;
       }
   
  -    if ((apr_os_level >= APR_WIN_NT) 
  -            && (wanted & (APR_FINFO_IDENT | APR_FINFO_NLINK))) {
  -        /* FindFirstFile and GetFileAttributesEx can't figure the inode,
  -         * device or number of links, so we need to resolve with an open 
  -         * file handle.  If the user has asked for these fields, fall over 
  -         * to the get file info by handle method.  If we fail, or the user
  -         * also asks for the file name, continue by our usual means.
  -         */
  -        if ((ident_rv = resolve_ident(finfo, fname, wanted, pool)) 
  -                == APR_SUCCESS)
  -            return ident_rv;
  -        else if (ident_rv == APR_INCOMPLETE)
  -            wanted &= ~finfo->valid;
  -    }
  -
   #if APR_HAS_UNICODE_FS
       IF_WIN_OS_IS_UNICODE
       {
  +        if ((wanted & (APR_FINFO_IDENT | APR_FINFO_NLINK)) 
  +               || (~wanted & APR_FINFO_LINK)) {
  +            /* FindFirstFile and GetFileAttributesEx can't figure the inode,
  +             * device or number of links, so we need to resolve with an open 
  +             * file handle.  If the user has asked for these fields, fall over 
  +             * to the get file info by handle method.  If we fail, or the user
  +             * also asks for the file name, continue by our usual means.
  +             *
  +             * We also must use this method for a 'true' stat, that resolves
  +             * a symlink (NTFS Junction) target.  This is because all fileinfo
  +             * on a Junction always returns the junction, opening the target
  +             * is the only way to resolve the target's attributes.
  +             */
  +            if ((ident_rv = resolve_ident(finfo, fname, wanted, pool)) 
  +                    == APR_SUCCESS)
  +                return ident_rv;
  +            else if (ident_rv == APR_INCOMPLETE)
  +                wanted &= ~finfo->valid;
  +        }
  +
           if (rv = utf8_to_unicode_path(wfname, sizeof(wfname) 
                                               / sizeof(apr_wchar_t), fname))
               return rv;
  
  
  

Mime
View raw message