You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by bj...@locus.apache.org on 2000/07/07 08:01:21 UTC

cvs commit: apache-2.0/src/lib/apr/file_io/os2 fileio.h open.c

bjh         00/07/06 23:01:21

  Modified:    src/lib/apr/file_io/os2 fileio.h open.c
  Log:
  OS/2: Provide native implementation of ap_rename_file().
  
  Revision  Changes    Path
  1.19      +1 -0      apache-2.0/src/lib/apr/file_io/os2/fileio.h
  
  Index: fileio.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/os2/fileio.h,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- fileio.h	2000/04/22 06:16:19	1.18
  +++ fileio.h	2000/07/07 06:01:20	1.19
  @@ -56,6 +56,7 @@
   #define FILE_IO_H
   
   #define INCL_DOS
  +#define INCL_DOSERRORS
   #include <os2.h>
   
   #include "apr_private.h"
  
  
  
  1.29      +10 -8     apache-2.0/src/lib/apr/file_io/os2/open.c
  
  Index: open.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/os2/open.c,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- open.c	2000/07/07 02:16:00	1.28
  +++ open.c	2000/07/07 06:01:20	1.29
  @@ -58,9 +58,6 @@
   #include "apr_portable.h"
   #include <string.h>
   
  -#define INCL_DOS
  -#include <os2.h>
  -
   ap_status_t apr_file_cleanup(void *thefile)
   {
       ap_file_t *file = thefile;
  @@ -191,12 +188,17 @@
   ap_status_t ap_rename_file(const char *from_path, const char *to_path,
                              ap_pool_t *p)
   {
  -    /* ### use an OS/2 specific function and error handling here... */
  -    if (rename(from_path, to_path) != 0) {
  -        /* ### wrong error code, but we don't have APR_ERROR */
  -        return APR_EINVAL;
  +    ULONG rc = DosMove(from_path, to_path);
  +
  +    if (rc == ERROR_ACCESS_DENIED) {
  +        rc = DosDelete(to_path);
  +
  +        if (rc == 0 || rc == ERROR_FILE_NOT_FOUND) {
  +            rc = DosMove(from_path, to_path);
  +        }
       }
  -    return APR_SUCCESS;
  +
  +    return APR_OS2_STATUS(rc);
   }