[master] 8f33a90 These are fatal as well

Federico G. Schwindt fgsch at lodoss.net
Fri Mar 3 13:30:07 CET 2017


commit 8f33a9078a537e5051ed9dc57715a52f72698cc5
Author: Federico G. Schwindt <fgsch at lodoss.net>
Date:   Fri Mar 3 12:26:29 2017 +0000

    These are fatal as well

diff --git a/bin/varnishtest/vtc_server.c b/bin/varnishtest/vtc_server.c
index c1ad16b..f9b01a1 100644
--- a/bin/varnishtest/vtc_server.c
+++ b/bin/varnishtest/vtc_server.c
@@ -81,6 +81,8 @@ server_new(const char *name)
 	REPLACE(s->name, name);
 	s->vl = vtc_logopen(s->name);
 	AN(s->vl);
+	if (*s->name != 's')
+		vtc_fatal(s->vl, "Server name must start with 's'");
 
 	bprintf(s->listen, "%s", "127.0.0.1 0");
 	s->repeat = 1;
@@ -361,12 +363,6 @@ cmd_server(CMD_ARGS)
 	AZ(strcmp(av[0], "server"));
 	av++;
 
-	if (*av[0] != 's') {
-		fprintf(stderr, "Server name must start with 's' (is: %s)\n",
-		    av[0]);
-		exit(1);
-	}
-
 	AZ(pthread_mutex_lock(&server_mtx));
 	VTAILQ_FOREACH(s, &servers, list)
 		if (!strcmp(s->name, av[0]))
@@ -417,11 +413,9 @@ cmd_server(CMD_ARGS)
 			continue;
 		}
 		if (!strcmp(*av, "-dispatch")) {
-			if (strcmp(s->name, "s0")) {
-				fprintf(stderr,
-				    "server -dispatch only works on s0\n");
-				exit(1);
-			}
+			if (strcmp(s->name, "s0"))
+				vtc_fatal(s->vl,
+				    "server -dispatch only works on s0");
 			server_dispatch(s);
 			continue;
 		}



More information about the varnish-commit mailing list