martin      99/10/23 13:15:18

  Modified:    src/lib/apr/file_io/unix dir.c
               src/lib/apr/file_io/win32 dir.c
               src/lib/apr/include apr_portable.h
  Log:
  Fix interface of ap_get_os_dir(): it previously modified a local
  pointer without returning anything sensible.
  Also, in ap_readdir() I modified a questionable use of an
  uninitialized variable (save_errno) which could result in
  an endless loop returning APR_SUCCESS when in fact EOF was reached.
  
  Revision  Changes    Path
  1.12      +6 -7      apache-2.0/src/lib/apr/file_io/unix/dir.c
  
  Index: dir.c
  ===================================================================
  RCS file: /export/home/cvs/apache-2.0/src/lib/apr/file_io/unix/dir.c,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- dir.c     1999/10/21 13:15:55     1.11
  +++ dir.c     1999/10/23 20:15:16     1.12
  @@ -127,13 +127,12 @@
   #if APR_HAS_THREADS && _POSIX_THREAD_SAFE_FUNCTIONS 
       return readdir_r(thedir->dirstruct, thedir->entry, &thedir->entry);
   #else
  -    int save_errno;
  -    ap_status_t status;
   
       thedir->entry = readdir(thedir->dirstruct);
       if (thedir->entry == NULL) {
  -        if (errno == save_errno) {
  -            return APR_SUCCESS;
  +        /* If NULL was returned, this can NEVER be a success. Can it?! */
  +        if (errno == APR_SUCCESS) {
  +            return APR_ENOENT;
           }
           return errno;
       }
  @@ -294,17 +293,17 @@
   }
   
   /* ***APRDOC********************************************************
  - * ap_status_t ap_get_os_dir(ap_os_dir_t *, ap_dir_t *)
  + * ap_status_t ap_get_os_dir(ap_os_dir_t **, ap_dir_t *)
    *    convert the dir from apr type to os specific type.
    * arg 1) The apr dir to convert.
    * arg 2) The os specific dir we are converting to
    */   
  -ap_status_t ap_get_os_dir(ap_os_dir_t *thedir, struct dir_t *dir)
  +ap_status_t ap_get_os_dir(ap_os_dir_t **thedir, struct dir_t *dir)
   {
       if (dir == NULL) {
           return APR_ENODIR;
       }
  -    thedir = dir->dirstruct;
  +    *thedir = dir->dirstruct;
       return APR_SUCCESS;
   }
   
  
  
  
  1.6       +2 -2      apache-2.0/src/lib/apr/file_io/win32/dir.c
  
  Index: dir.c
  ===================================================================
  RCS file: /export/home/cvs/apache-2.0/src/lib/apr/file_io/win32/dir.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- dir.c     1999/10/12 06:14:43     1.5
  +++ dir.c     1999/10/23 20:15:17     1.6
  @@ -210,12 +210,12 @@
       return APR_SUCCESS;
   }
   
  -ap_status_t ap_get_os_dir(ap_os_dir_t *thedir, struct dir_t *dir)
  +ap_status_t ap_get_os_dir(ap_os_dir_t **thedir, struct dir_t *dir)
   {
       if (dir == NULL) {
           return APR_ENODIR;
       }
  -    thedir = dir->dirhand;
  +    *thedir = dir->dirhand;
       return APR_SUCCESS;
   }
   
  
  
  
  1.12      +1 -1      apache-2.0/src/lib/apr/include/apr_portable.h
  
  Index: apr_portable.h
  ===================================================================
  RCS file: /export/home/cvs/apache-2.0/src/lib/apr/include/apr_portable.h,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- apr_portable.h    1999/10/22 22:30:41     1.11
  +++ apr_portable.h    1999/10/23 20:15:18     1.12
  @@ -187,7 +187,7 @@
   #endif
   
   ap_status_t ap_get_os_file(ap_os_file_t *, ap_file_t *);     
  -ap_status_t ap_get_os_dir(ap_os_dir_t *, ap_dir_t *);      
  +ap_status_t ap_get_os_dir(ap_os_dir_t **, ap_dir_t *);      
   ap_status_t ap_get_os_sock(ap_os_sock_t *, ap_socket_t *);
   ap_status_t ap_get_os_lock(ap_os_lock_t *, ap_lock_t *);     
   ap_status_t ap_get_os_proc(ap_os_proc_t *, ap_proc_t *);     
  
  
  

Reply via email to