r289 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Mon Jul 3 21:45:12 CEST 2006


Author: phk
Date: 2006-07-03 21:45:12 +0200 (Mon, 03 Jul 2006)
New Revision: 289

Modified:
   trunk/varnish-cache/bin/varnishd/storage_file.c
Log:
My workaround for the missing OFF_T_MAX definition was not safe,
use a hardcoded "1<<30" which is.



Modified: trunk/varnish-cache/bin/varnishd/storage_file.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/storage_file.c	2006-07-03 19:35:05 UTC (rev 288)
+++ trunk/varnish-cache/bin/varnishd/storage_file.c	2006-07-03 19:45:12 UTC (rev 289)
@@ -419,10 +419,12 @@
 	void *p;
 	off_t h;
 
-	if (*fail < sc->pagesize * MINPAGES)
+	assert(sz != 0);
+
+	if (*fail < (uintmax_t)sc->pagesize * MINPAGES)
 		return;
 
-	if (sz < *fail && sz < SIZE_T_MAX) {
+	if (sz > 0 && sz < *fail && sz < SIZE_T_MAX) {
 		p = mmap(NULL, sz, PROT_READ|PROT_WRITE,
 		    MAP_NOCORE | MAP_NOSYNC | MAP_SHARED, sc->fd, off);
 		if (p != MAP_FAILED) {
@@ -448,7 +450,7 @@
 smf_open(struct stevedore *st)
 {
 	struct smf_sc *sc;
-	off_t fail = SIZE_T_MAX;
+	off_t fail = 1 << 30;	/* XXX: where is OFF_T_MAX ? */
 	off_t sum = 0;
 
 	sc = st->priv;




More information about the varnish-commit mailing list