fd: Allow passing NULL to para_munmap().
authorAndre Noll <maan@systemlinux.org>
Tue, 26 Apr 2011 14:33:44 +0000 (16:33 +0200)
committerAndre Noll <maan@systemlinux.org>
Tue, 26 Apr 2011 14:33:44 +0000 (16:33 +0200)
This patch makes para_munmap succeed with return value 0 if the passed
"start" pointer is NULL. This allows to simplify the code in the
callers a bit, similar to free(NULL).

fd.c

diff --git a/fd.c b/fd.c
index 6f9266f..ea16bdd 100644 (file)
--- a/fd.c
+++ b/fd.c
@@ -563,6 +563,9 @@ out:
 int para_munmap(void *start, size_t length)
 {
        int err;
+
+       if (!start)
+               return 0;
        if (munmap(start, length) >= 0)
                return 1;
        err = errno;