[master] 1dfd93b Give error message on -f filter parse errors for VSC (and varnishstat)

Martin Blix Grydeland martin at varnish-cache.org
Tue Nov 19 17:37:57 CET 2013


commit 1dfd93b14146425619682739fbcc2256337b3f99
Author: Martin Blix Grydeland <martin at varnish-software.com>
Date:   Mon Nov 18 14:20:57 2013 +0100

    Give error message on -f filter parse errors for VSC (and varnishstat)

diff --git a/bin/varnishstat/varnishstat.c b/bin/varnishstat/varnishstat.c
index 72ad021..a11a44a 100644
--- a/bin/varnishstat/varnishstat.c
+++ b/bin/varnishstat/varnishstat.c
@@ -296,6 +296,7 @@ main(int argc, char * const *argv)
 		default:
 			if (VSC_Arg(vd, c, optarg) > 0)
 				break;
+			fprintf(stderr, "%s\n", VSM_Error(vd));
 			usage();
 		}
 	}
diff --git a/lib/libvarnishapi/vsc.c b/lib/libvarnishapi/vsc.c
index c617520..2df4d9e 100644
--- a/lib/libvarnishapi/vsc.c
+++ b/lib/libvarnishapi/vsc.c
@@ -226,6 +226,9 @@ vsc_f_arg(struct VSM_data *vd, const char *opt)
 			if (q != NULL && q[1] == '\0') {
 				*q = '\0';
 				sf->flags |= VSC_SF_TY_WC;
+			} else if (q != NULL) {
+				i = -1;
+				break;
 			}
 		}
 		if (sf->ident != NULL) {
@@ -233,6 +236,9 @@ vsc_f_arg(struct VSM_data *vd, const char *opt)
 			if (q != NULL && q[1] == '\0') {
 				*q = '\0';
 				sf->flags |= VSC_SF_ID_WC;
+			} else if (q != NULL) {
+				i = -1;
+				break;
 			}
 		}
 		if (sf->name != NULL) {
@@ -240,11 +246,18 @@ vsc_f_arg(struct VSM_data *vd, const char *opt)
 			if (q != NULL && q[1] == '\0') {
 				*q = '\0';
 				sf->flags |= VSC_SF_NM_WC;
+			} else if (q != NULL) {
+				i = -1;
+				break;
 			}
 		}
 	}
+	if (i < 0)
+		i = vsm_diag(vd, "Wildcard error: %s", opt);
+	else
+		i = 1;
 	VAV_Free(av);
-	return (1);
+	return (i);
 }
 
 /*--------------------------------------------------------------------*/



More information about the varnish-commit mailing list