rbb 99/12/15 10:06:35
Modified: src/lib/apr/file_io/win32 filedup.c open.c Log: Fix ap_dupfile on Win32. We need to actually duplicate the file, not just assign the old handle to the new ap_file_t. Revision Changes Path 1.4 +4 -2 apache-2.0/src/lib/apr/file_io/win32/filedup.c Index: filedup.c =================================================================== RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/win32/filedup.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- filedup.c 1999/10/12 06:14:43 1.3 +++ filedup.c 1999/12/15 18:06:31 1.4 @@ -61,14 +61,16 @@ ap_status_t ap_dupfile(struct file_t **new_file, struct file_t *old_file) { + HANDLE hCurrentProcess = GetCurrentProcess(); (*new_file) = (struct file_t *)ap_palloc(old_file->cntxt, sizeof(struct file_t)); if ((*new_file) == NULL) { return APR_ENOMEM; } - (*new_file)->cntxt = old_file->cntxt; - (*new_file)->filehand = old_file->filehand; + (*new_file)->cntxt = old_file->cntxt; + DuplicateHandle(hCurrentProcess, old_file->filehand, hCurrentProcess, + &(*new_file)->filehand, 0, FALSE, DUPLICATE_SAME_ACCESS); (*new_file)->fname = ap_pstrdup(old_file->cntxt, old_file->fname); (*new_file)->demonfname = ap_pstrdup(old_file->cntxt, old_file->demonfname); (*new_file)->lowerdemonfname = ap_pstrdup(old_file->cntxt, old_file->lowerdemonfname); 1.14 +2 -1 apache-2.0/src/lib/apr/file_io/win32/open.c Index: open.c =================================================================== RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/win32/open.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- open.c 1999/12/14 18:25:48 1.13 +++ open.c 1999/12/15 18:06:32 1.14 @@ -61,6 +61,7 @@ #include "apr_lib.h" #include "apr_portable.h" #include <errno.h> +#include <winbase.h> #include <string.h> #include <sys/stat.h> @@ -202,7 +203,7 @@ ap_status_t ap_open_stderr(struct file_t **thefile, ap_context_t *cont) { - (*thefile) = ap_pcalloc(cont, sizeof(ap_os_file_t *)); + (*thefile) = ap_pcalloc(cont, sizeof(struct file_t *)); if ((*thefile) == NULL) { return APR_ENOMEM; }