diff options
author | stoddard <stoddard@13f79535-47bb-0310-9956-ffa450edef68> | 2000-02-01 00:51:45 +0000 |
---|---|---|
committer | stoddard <stoddard@13f79535-47bb-0310-9956-ffa450edef68> | 2000-02-01 00:51:45 +0000 |
commit | b96de10b0a4409922d23a62138e3dc1064b1ed01 (patch) | |
tree | bb69a42725cb943f0f415589caa8f79aa00ac241 | |
parent | e15fde1ceddfa1f3e3c86ca30cbdc2622480edff (diff) | |
download | libapr-b96de10b0a4409922d23a62138e3dc1064b1ed01.tar.gz |
Return correct error status
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@59641 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | file_io/win32/dir.c | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/file_io/win32/dir.c b/file_io/win32/dir.c index 71e159735..fc63ff917 100644 --- a/file_io/win32/dir.c +++ b/file_io/win32/dir.c @@ -103,11 +103,11 @@ ap_status_t ap_opendir(struct dir_t **new, const char *dirname, ap_context_t *co ap_status_t ap_closedir(struct dir_t *thedir) { - if (FindClose(thedir->dirhand)) { - ap_kill_cleanup(thedir->cntxt, thedir, dir_cleanup); - return APR_SUCCESS; + if (!FindClose(thedir->dirhand)) { + return GetLastError(); } - return APR_EEXIST; + ap_kill_cleanup(thedir->cntxt, thedir, dir_cleanup); + return APR_SUCCESS; } ap_status_t ap_readdir(struct dir_t *thedir) @@ -116,14 +116,14 @@ ap_status_t ap_readdir(struct dir_t *thedir) thedir->entry = ap_palloc(thedir->cntxt, sizeof(WIN32_FIND_DATA)); thedir->dirhand = FindFirstFile(thedir->dirname, thedir->entry); if (thedir->dirhand == INVALID_HANDLE_VALUE) { - return APR_EEXIST; + return GetLastError(); } return APR_SUCCESS; } - if (FindNextFile(thedir->dirhand, thedir->entry)) { - return APR_SUCCESS; + if (!FindNextFile(thedir->dirhand, thedir->entry)) { + return GetLastError(); } - return APR_EEXIST; + return APR_SUCCESS; } ap_status_t ap_rewinddir(struct dir_t *thedir) @@ -146,21 +146,19 @@ ap_status_t ap_rewinddir(struct dir_t *thedir) ap_status_t ap_make_dir(const char *path, ap_fileperms_t perm, ap_context_t *cont) { - if (CreateDirectory(path, NULL)) { - return APR_SUCCESS; + if (!CreateDirectory(path, NULL)) { + return GetLastError(); } - return APR_EEXIST; + return APR_SUCCESS; } ap_status_t ap_remove_dir(const char *path, ap_context_t *cont) { - DWORD huh; char *temp = canonical_filename(cont, path); - if (RemoveDirectory(temp)) { - return APR_SUCCESS; + if (!RemoveDirectory(temp)) { + return GetLastError(); } - huh = GetLastError(); - return APR_EEXIST; + return APR_SUCCESS; } ap_status_t ap_dir_entry_size(ap_ssize_t *size, struct dir_t *thedir) |