[master] 0a556c7 Make path mandatory in -sfile

Martin Blix Grydeland martin at varnish-software.com
Tue Oct 21 12:25:43 CEST 2014


commit 0a556c7a996a089bb375964f8a92bb61d318bbe9
Author: Martin Blix Grydeland <martin at varnish-software.com>
Date:   Tue Oct 7 15:55:36 2014 +0200

    Make path mandatory in -sfile

diff --git a/bin/varnishd/mgt/mgt_main.c b/bin/varnishd/mgt/mgt_main.c
index ae90fe0..5c1e580 100644
--- a/bin/varnishd/mgt/mgt_main.c
+++ b/bin/varnishd/mgt/mgt_main.c
@@ -171,7 +171,6 @@ usage(void)
 #ifdef HAVE_LIBUMEM
 	fprintf(stderr, FMT, "", "  -s umem");
 #endif
-	fprintf(stderr, FMT, "", "  -s file  [default: use /tmp]");
 	fprintf(stderr, FMT, "", "  -s file,<dir_or_file>");
 	fprintf(stderr, FMT, "", "  -s file,<dir_or_file>,<size>");
 	fprintf(stderr, FMT, "",
diff --git a/bin/varnishd/storage/storage_file.c b/bin/varnishd/storage/storage_file.c
index b1be095..04d9707 100644
--- a/bin/varnishd/storage/storage_file.c
+++ b/bin/varnishd/storage/storage_file.c
@@ -108,8 +108,6 @@ smf_initfile(struct smf_sc *sc, const char *size)
 	/* XXX: force block allocation here or in open ? */
 }
 
-static const char default_filename[] = ".";
-
 static void
 smf_init(struct stevedore *parent, int ac, char * const *av)
 {
@@ -120,14 +118,15 @@ smf_init(struct stevedore *parent, int ac, char * const *av)
 
 	AZ(av[ac]);
 
-	fn = default_filename;
+	fn = NULL;
 	size = NULL;
 	page_size = getpagesize();
 
 	if (ac > 3)
 		ARGV_ERR("(-sfile) too many arguments\n");
-	if (ac > 0 && *av[0] != '\0')
-		fn = av[0];
+	if (ac < 1 || *av[0] == '\0')
+		ARGV_ERR("(-sfile) path is mandatory\n");
+	fn = av[0];
 	if (ac > 1 && *av[1] != '\0')
 		size = av[1];
 	if (ac > 2 && *av[2] != '\0') {
diff --git a/doc/sphinx/reference/varnishd.rst b/doc/sphinx/reference/varnishd.rst
index 6014637..4bc9cc9 100644
--- a/doc/sphinx/reference/varnishd.rst
+++ b/doc/sphinx/reference/varnishd.rst
@@ -112,7 +112,7 @@ OPTIONS
 -s [name=]type[,options]
             Use the specified storage backend. The storage backends can be one of the following:
                * malloc[,size]
-               * file[,path[,size[,granularity]]]
+               * file,path[,size[,granularity]]
                * persistent,path,size
 
             See Storage Types in the Users Guide for more information
@@ -177,7 +177,7 @@ malloc is a memory based backend.
 file
 ~~~~
 
-syntax: file[,path[,size[,granularity]]]
+syntax: file,path[,size[,granularity]]
 
 The file backend stores data in a file on disk. The file will be accessed using mmap.
 



More information about the varnish-commit mailing list