From b2e70f27eff1863c4874757b9c93c00316cae228 Mon Sep 17 00:00:00 2001 From: phk Date: Mon, 3 Jul 2006 19:45:12 +0000 Subject: [PATCH] My workaround for the missing OFF_T_MAX definition was not safe, use a hardcoded "1<<30" which is. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@289 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishd/storage_file.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/varnish-cache/bin/varnishd/storage_file.c b/varnish-cache/bin/varnishd/storage_file.c index 9fc78f4d..c7213a49 100644 --- a/varnish-cache/bin/varnishd/storage_file.c +++ b/varnish-cache/bin/varnishd/storage_file.c @@ -419,10 +419,12 @@ smf_open_chunk(struct smf_sc *sc, off_t sz, off_t off, off_t *fail, off_t *sum) 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 @@ static void 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; -- 2.39.5