INN commit: trunk/contrib (mlockfile.c)

INN Commit rra at isc.org
Thu Sep 8 17:29:57 UTC 2011


    Date: Thursday, September 8, 2011 @ 10:29:57
  Author: iulius
Revision: 9375

fix signedness issues in the results of ternary constructions

Modified:
  trunk/contrib/mlockfile.c

-------------+
 mlockfile.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Modified: mlockfile.c
===================================================================
--- mlockfile.c	2011-09-08 17:28:50 UTC (rev 9374)
+++ mlockfile.c	2011-09-08 17:29:57 UTC (rev 9375)
@@ -56,7 +56,7 @@
 		     ml->st.st_size != st.st_size) {
 		if (ml->base != MAP_FAILED)
 		    munmap(ml->base,
-			   ml->length ? ml->length : ml->st.st_size);
+			   ml->length > 0 ? ml->length : (size_t) ml->st.st_size);
 
 		/* free everything here, so in case of failure we try
 		 * again next time */
@@ -65,7 +65,7 @@
 		ml->st.st_size = 0;
 
 		ml->base = mmap(NULL,
-				ml->length ? ml->length : st.st_size,
+				ml->length > 0 ? ml->length : (size_t) st.st_size,
 				PROT_READ,
 				MAP_SHARED, fd, ml->offset);
 
@@ -74,7 +74,7 @@
 			    progname, ml->path, strerror(errno));
 		} else {
 		    if (mlock(ml->base,
-			      ml->length ? ml->length : st.st_size) != 0) {
+			      ml->length > 0 ? ml->length : (size_t) st.st_size) != 0) {
 			fprintf(stderr, "%s: can't mlock `%s' - %s\n",
 				progname, ml->path, strerror(errno));
 		    } else {
@@ -82,7 +82,7 @@
 		    }
 		}
 	    } else if (flush) {
-		msync(ml->base, ml->length ? ml->length : st.st_size, MS_SYNC);
+		msync(ml->base, ml->length > 0 ? ml->length : (size_t) st.st_size, MS_SYNC);
 	    }
 	}
 	close (fd);




More information about the inn-committers mailing list