From: phk Date: Wed, 19 Jul 2006 20:06:18 +0000 (+0000) Subject: Don't explode on trim's to zero size. X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=88d3dd6715ddb93b0ce8edeb7531885a162bb068;p=varnish Don't explode on trim's to zero size. Real fix should (maybe) be to callers git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@507 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/bin/varnishd/storage_file.c b/varnish-cache/bin/varnishd/storage_file.c index f623d6ad..2aedafd1 100644 --- a/varnish-cache/bin/varnishd/storage_file.c +++ b/varnish-cache/bin/varnishd/storage_file.c @@ -507,6 +507,10 @@ smf_trim(struct storage *s, size_t size) struct smf *smf; struct smf_sc *sc; + if (size == 0) { + /* XXX: this should not happen */ + return; + } assert(size <= s->space); assert(size > 0); /* XXX: seen */ smf = (struct smf *)(s->priv);