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 6f9266f47a56cd8dee3e99b8651d12a89bb4069b..ea16bdda993aff814fa41684af53506e46242a4f 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;