bjh 02/01/19 22:41:50
Modified: file_io/os2 filedup.c
Log:
OS/2: Add apr_file_dup2().
Revision Changes Path
1.24 +24 -1 apr/file_io/os2/filedup.c
Index: filedup.c
===================================================================
RCS file: /home/cvs/apr/file_io/os2/filedup.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- filedup.c 10 Aug 2001 21:04:47 -0000 1.23
+++ filedup.c 20 Jan 2002 06:41:50 -0000 1.24
@@ -59,7 +59,7 @@
#include <string.h>
#include "inherit.h"
-APR_DECLARE(apr_status_t) apr_file_dup(apr_file_t **new_file, apr_file_t
*old_file, apr_pool_t *p)
+static apr_status_t file_dup(apr_file_t **new_file, apr_file_t *old_file,
apr_pool_t *p)
{
int rv;
apr_file_t *dup_file;
@@ -97,4 +97,27 @@
}
return APR_SUCCESS;
+}
+
+
+
+APR_DECLARE(apr_status_t) apr_file_dup(apr_file_t **new_file, apr_file_t
*old_file, apr_pool_t *p)
+{
+ if (*new_file) {
+ apr_file_close(*new_file);
+ (*new_file)->filedes = -1;
+ }
+
+ return file_dup(new_file, old_file, p);
+}
+
+
+
+APR_DECLARE(apr_status_t) apr_file_dup2(apr_file_t **new_file, apr_file_t
*old_file, apr_pool_t *p)
+{
+ if (*new_file == NULL) {
+ return APR_EINVAL;
+ }
+
+ return file_dup(new_file, old_file, p);
}