summaryrefslogtreecommitdiff
path: root/mmap
diff options
context:
space:
mode:
authorCliff Woolley <jwoolley@apache.org>2002-04-10 04:54:21 +0000
committerCliff Woolley <jwoolley@apache.org>2002-04-10 04:54:21 +0000
commit67996e28e6b0943dc2347689762de9e1d8f5bff1 (patch)
treed841493b9991733321006063c67b883c1f51cf99 /mmap
parent79d766d17f78bc160621203f8f542e1cf9244611 (diff)
downloadapr-67996e28e6b0943dc2347689762de9e1d8f5bff1.tar.gz
Sanitize some return types.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@63242 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'mmap')
-rw-r--r--mmap/unix/mmap.c10
-rw-r--r--mmap/win32/mmap.c10
2 files changed, 12 insertions, 8 deletions
diff --git a/mmap/unix/mmap.c b/mmap/unix/mmap.c
index 21996add8..3f081308e 100644
--- a/mmap/unix/mmap.c
+++ b/mmap/unix/mmap.c
@@ -85,8 +85,10 @@ static apr_status_t mmap_cleanup(void *themmap)
apr_mmap_t *mm = themmap;
int rv;
- if ((!mm->is_owner) || (mm->mm == (void *)-1)) {
- /* XXX: we shouldn't ever get here */
+ if (!mm->is_owner) {
+ return APR_EINVAL;
+ }
+ else if (mm->mm == (void *)-1) {
return APR_ENOENT;
}
@@ -197,9 +199,9 @@ APR_DECLARE(apr_status_t) apr_mmap_dup(apr_mmap_t **new_mmap,
APR_DECLARE(apr_status_t) apr_mmap_delete(apr_mmap_t *mm)
{
- apr_status_t rv = APR_SUCCESS;
+ apr_status_t rv;
- if (mm->is_owner && ((rv = mmap_cleanup(mm)) == APR_SUCCESS)) {
+ if ((rv = mmap_cleanup(mm)) == APR_SUCCESS) {
apr_pool_cleanup_kill(mm->cntxt, mm, mmap_cleanup);
return APR_SUCCESS;
}
diff --git a/mmap/win32/mmap.c b/mmap/win32/mmap.c
index 836c6d92d..2d3d61a4c 100644
--- a/mmap/win32/mmap.c
+++ b/mmap/win32/mmap.c
@@ -68,8 +68,10 @@ static apr_status_t mmap_cleanup(void *themmap)
apr_mmap_t *mm = themmap;
apr_status_t rv = 0;
- if (!mm->is_owner || !mm->mhandle) {
- /* XXX: we shouldn't ever get here */
+ if (!mm->is_owner) {
+ return APR_EINVAL;
+ }
+ else if (!mm->mhandle) {
return APR_ENOENT;
}
@@ -197,9 +199,9 @@ APR_DECLARE(apr_status_t) apr_mmap_dup(apr_mmap_t **new_mmap,
APR_DECLARE(apr_status_t) apr_mmap_delete(apr_mmap_t *mm)
{
- apr_status_t rv = APR_SUCCESS;
+ apr_status_t rv;
- if (mm->is_owner && ((rv = mmap_cleanup(mm)) == APR_SUCCESS)) {
+ if ((rv = mmap_cleanup(mm)) == APR_SUCCESS) {
apr_pool_cleanup_kill(mm->cntxt, mm, mmap_cleanup);
return APR_SUCCESS;
}