[master] 389d414a0 Emit a usable ARGV_ERR if a -sfile is too small

Poul-Henning Kamp phk at FreeBSD.org
Wed Jan 10 12:36:09 UTC 2024


commit 389d414a041343a3e73c19b17ec3de28d665b535
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Wed Jan 10 12:34:58 2024 +0000

    Emit a usable ARGV_ERR if a -sfile is too small

diff --git a/bin/varnishd/storage/storage_file.c b/bin/varnishd/storage/storage_file.c
index b5148ac36..4a01ae6d2 100644
--- a/bin/varnishd/storage/storage_file.c
+++ b/bin/varnishd/storage/storage_file.c
@@ -420,6 +420,13 @@ smf_open(struct stevedore *st)
 	Lck_Lock(&sc->mtx);
 	smf_open_chunk(sc, sc->filesize, 0, &fail, &sum);
 	Lck_Unlock(&sc->mtx);
+	if (sum < MINPAGES * (off_t)getpagesize()) {
+		ARGV_ERR(
+		    "-sfile too small for this architecture,"
+		    " minimum size is %jd MB\n",
+		    (MINPAGES * (intmax_t)getpagesize()) >> 20
+		);
+	}
 	printf("SMF.%s mmap'ed %ju bytes of %ju\n",
 	    st->ident, (uintmax_t)sum, sc->filesize);
 


More information about the varnish-commit mailing list