[master] 607b7af Update varnishadm to use new api

Martin Blix Grydeland martin at varnish-cache.org
Wed May 15 14:46:14 CEST 2013


commit 607b7af79c370960de611ddc1e9044d119aca576
Author: Martin Blix Grydeland <martin at varnish-software.com>
Date:   Sun Apr 28 22:09:12 2013 +0200

    Update varnishadm to use new api

diff --git a/bin/Makefile.am b/bin/Makefile.am
index 226c670..8e481e5 100644
--- a/bin/Makefile.am
+++ b/bin/Makefile.am
@@ -3,7 +3,7 @@
 # Disabling building of the tools while api is in flux
 
 #SUBDIRS = varnishadm varnishd varnishlog varnishncsa varnishreplay varnishtest
-SUBDIRS = varnishd varnishlog
+SUBDIRS = varnishadm varnishd varnishlog
 
 if HAVE_CURSES
 #SUBDIRS += varnishhist varnishstat varnishtop
diff --git a/bin/varnishadm/varnishadm.c b/bin/varnishadm/varnishadm.c
index 532ab72..4029178 100644
--- a/bin/varnishadm/varnishadm.c
+++ b/bin/varnishadm/varnishadm.c
@@ -326,26 +326,29 @@ n_arg_sock(const char *n_arg)
 {
 	char *T_arg = NULL, *T_start = NULL;
 	char *S_arg = NULL;
-	struct VSM_data *vsd;
+	struct VSM_data *vsm;
 	char *p;
 	int sock;
 	struct VSM_fantom vt;
 
-	vsd = VSM_New();
-	assert(VSL_Arg(vsd, 'n', n_arg));
-	if (VSM_Open(vsd)) {
-		fprintf(stderr, "%s\n", VSM_Error(vsd));
+	vsm = VSM_New();
+	if (VSM_n_Arg(vsm, n_arg) < 0) {
+		fprintf(stderr, "%s\n", VSM_Error(vsm));
+		return (-1);
+	}
+	if (VSM_Open(vsm)) {
+		fprintf(stderr, "%s\n", VSM_Error(vsm));
 		return (-1);
 	}
 
-	if (!VSM_Get(vsd, &vt, "Arg", "-T", "")) {
+	if (!VSM_Get(vsm, &vt, "Arg", "-T", "")) {
 		fprintf(stderr, "No -T arg in shared memory\n");
 		return (-1);
 	}
 	AN(vt.b);
 	T_start = T_arg = strdup(vt.b);
 
-	if (VSM_Get(vsd, &vt, "Arg", "-S", "")) {
+	if (VSM_Get(vsm, &vt, "Arg", "-S", "")) {
 		AN(vt.b);
 		S_arg = strdup(vt.b);
 	}



More information about the varnish-commit mailing list