summaryrefslogtreecommitdiff
path: root/mmap
diff options
context:
space:
mode:
authorjwoolley <jwoolley@13f79535-47bb-0310-9956-ffa450edef68>2002-04-10 04:54:21 +0000
committerjwoolley <jwoolley@13f79535-47bb-0310-9956-ffa450edef68>2002-04-10 04:54:21 +0000
commit4af722e09a1f7e2db252dfd7eb9fdd3978fb2bce (patch)
treed841493b9991733321006063c67b883c1f51cf99 /mmap
parentd508a6cf36b0c7a82c6b67ce1c15403937497b95 (diff)
downloadlibapr-4af722e09a1f7e2db252dfd7eb9fdd3978fb2bce.tar.gz
Sanitize some return types.
git-svn-id: http://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;
}