You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ak...@locus.apache.org on 2000/06/09 23:24:28 UTC

cvs commit: apache-2.0/src/lib/apr/file_io/win32 filestat.c

ake         00/06/09 14:24:28

  Modified:    src/lib/apr/file_io/win32 filestat.c
  Log:
  Catch fname length = MAX_PATH since for some strange reason
  Win32 returns PATH_NOT_FOUND and that's not what we want.
  
  Revision  Changes    Path
  1.20      +10 -1     apache-2.0/src/lib/apr/file_io/win32/filestat.c
  
  Index: filestat.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/win32/filestat.c,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- filestat.c	2000/04/28 18:27:39	1.19
  +++ filestat.c	2000/06/09 21:24:27	1.20
  @@ -139,7 +139,16 @@
   
       memset(finfo,'\0', sizeof(*finfo));
   
  -    if (!ap_get_oslevel(cont, &os_level) && os_level >= APR_WIN_98) {
  +	/* We need to catch the case where fname length == MAX_PATH since for
  +	 * some strange reason GetFileAttributesEx fails with PATH_NOT_FOUND.
  +	 * We would rather indicate length error than 'not found'
  +	 * since in many cases the apr user is testing for 'not found' 
  +	 * and this is not such a case.
  +	 */
  +    if (strlen(fname) >= MAX_PATH) {
  +        rv = ERROR_FILENAME_EXCED_RANGE;
  +    }
  +    else if (!ap_get_oslevel(cont, &os_level) && os_level >= APR_WIN_98) {
           if (!GetFileAttributesEx(fname, GetFileExInfoStandard, 
                                    (WIN32_FILE_ATTRIBUTE_DATA*) &FileInformation)) {
               rv = GetLastError();