git » libjio » commit 2a09eda

Cast a parameter in mmap() to properly identify it as a void *.

author Alberto Bertogli
2007-03-30 05:10:10 UTC
committer Alberto Bertogli
2007-07-15 13:55:24 UTC
parent 9e64bf506b6e54819fd96e7fefc4bd6737ededd0

Cast a parameter in mmap() to properly identify it as a void *.

A sparse run complained about the first mmap() parameter (void *start, we have
it fixed to 0) is an integer being used as a pointer.

We could use NULL, but it might not be 0, and the mmap() manpage recommends it
to be 0, so we cast it to a void * instead.

Signed-off-by: Alberto Bertogli <albertito@gmail.com>

check.c +1 -1

diff --git a/check.c b/check.c
index 2257d78..95c6b60 100644
--- a/check.c
+++ b/check.c
@@ -248,7 +248,7 @@ int jfsck(const char *name, const char *jdir, struct jfsck_result *res)
 		filelen = lseek(tfd, 0, SEEK_END);
 		/* no overflow problems because we know the transaction size
 		 * is limited to SSIZE_MAX */
-		map = mmap(0, filelen, PROT_READ, MAP_SHARED, tfd, 0);
+		map = mmap((void *) 0, filelen, PROT_READ, MAP_SHARED, tfd, 0);
 		if (map == MAP_FAILED) {
 			res->broken++;
 			map = NULL;