summaryrefslogtreecommitdiff
path: root/file_io/win32/filedup.c
diff options
context:
space:
mode:
authorRyan Bloom <rbb@apache.org>1999-12-15 18:06:32 +0000
committerRyan Bloom <rbb@apache.org>1999-12-15 18:06:32 +0000
commitc42997729836eb4d577a777aa5f6e45fa0be64b0 (patch)
tree5a67a5783bddc860014a972d291a1a1f82bfa507 /file_io/win32/filedup.c
parent6c97428a2faf196385df84980912dff0a03e2243 (diff)
downloadapr-c42997729836eb4d577a777aa5f6e45fa0be64b0.tar.gz
Fix ap_dupfile on Win32. We need to actually duplicate the file, not
just assign the old handle to the new ap_file_t. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@59528 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'file_io/win32/filedup.c')
-rw-r--r--file_io/win32/filedup.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/file_io/win32/filedup.c b/file_io/win32/filedup.c
index 42c8cea2d..f135e4c6a 100644
--- a/file_io/win32/filedup.c
+++ b/file_io/win32/filedup.c
@@ -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);