summaryrefslogtreecommitdiff
path: root/file_io/win32/filedup.c
diff options
context:
space:
mode:
authorBill Stoddard <stoddard@apache.org>2000-02-15 00:48:24 +0000
committerBill Stoddard <stoddard@apache.org>2000-02-15 00:48:24 +0000
commita1c476049198d09f22d64931ee7bedffda18eb99 (patch)
tree8e72c7b55c4d6275596fca02ed768dc022501455 /file_io/win32/filedup.c
parentabf8329af15193b518b53aa1ecb049757116b02c (diff)
downloadapr-a1c476049198d09f22d64931ee7bedffda18eb99.tar.gz
Check for DuplicateHandle() failure.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@59655 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'file_io/win32/filedup.c')
-rw-r--r--file_io/win32/filedup.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/file_io/win32/filedup.c b/file_io/win32/filedup.c
index a7d9aeba5..c19e9e33b 100644
--- a/file_io/win32/filedup.c
+++ b/file_io/win32/filedup.c
@@ -76,12 +76,20 @@ ap_status_t ap_dupfile(struct file_t **new_file, struct file_t *old_file)
(*new_file)->cntxt = old_file->cntxt;
if (have_file) {
- DuplicateHandle(hCurrentProcess, (*new_file)->filehand, hCurrentProcess,
- &old_file->filehand, 0, FALSE, DUPLICATE_SAME_ACCESS);
+ if (!DuplicateHandle(hCurrentProcess, (*new_file)->filehand,
+ hCurrentProcess,
+ &old_file->filehand, 0, FALSE,
+ DUPLICATE_SAME_ACCESS)) {
+ return GetLastError();
+ }
}
else {
- DuplicateHandle(hCurrentProcess, old_file->filehand, hCurrentProcess,
- &(*new_file)->filehand, 0, FALSE, DUPLICATE_SAME_ACCESS);
+ if (!DuplicateHandle(hCurrentProcess, old_file->filehand,
+ hCurrentProcess,
+ &(*new_file)->filehand, 0, FALSE,
+ DUPLICATE_SAME_ACCESS)) {
+ return GetLastError();
+ }
}
(*new_file)->fname = ap_pstrdup(old_file->cntxt, old_file->fname);