[master] eb0e6a4 Improve a couple of error messages.

Poul-Henning Kamp phk at varnish-cache.org
Thu Oct 25 11:03:20 CEST 2012


commit eb0e6a4d08f85139a1c22a64348b8d60f0ec71c5
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Thu Oct 25 09:03:03 2012 +0000

    Improve a couple of error messages.

diff --git a/lib/libvcl/vcc_acl.c b/lib/libvcl/vcc_acl.c
index 3e037ec..d3db319 100644
--- a/lib/libvcl/vcc_acl.c
+++ b/lib/libvcl/vcc_acl.c
@@ -100,7 +100,7 @@ vcc_acl_add_entry(struct vcc *tl, const struct acl_e *ae, int l,
 
 	if (fam == PF_INET && ae->mask > 32) {
 		VSB_printf(tl->sb,
-		    "Too wide mask (%u) for IPv4 address", ae->mask);
+		    "Too wide mask (%u) for IPv4 address\n", ae->mask);
 		if (ae->t_mask != NULL)
 			vcc_ErrWhere(tl, ae->t_mask);
 		else
@@ -109,7 +109,7 @@ vcc_acl_add_entry(struct vcc *tl, const struct acl_e *ae, int l,
 	}
 	if (fam == PF_INET6 && ae->mask > 128) {
 		VSB_printf(tl->sb,
-		    "Too wide mask (%u) for IPv6 address", ae->mask);
+		    "Too wide mask (%u) for IPv6 address\n", ae->mask);
 		vcc_ErrWhere(tl, ae->t_mask);
 		return;
 	}
diff --git a/lib/libvcl/vcc_dir_random.c b/lib/libvcl/vcc_dir_random.c
index 4166918..e647bfd 100644
--- a/lib/libvcl/vcc_dir_random.c
+++ b/lib/libvcl/vcc_dir_random.c
@@ -38,7 +38,7 @@
 void
 vcc_ParseRandomDirector(struct vcc *tl)
 {
-	struct token *t_field, *t_be;
+	struct token *t_field, *t_be, *t_x;
 	int nelem;
 	struct fld_spec *fs, *mfs;
 	unsigned u, retries;
@@ -86,15 +86,14 @@ vcc_ParseRandomDirector(struct vcc *tl)
 				    first, p);
 			} else if (vcc_IdIs(t_field, "weight")) {
 				ExpectErr(tl, CNUM);
+				t_x = tl->t;
 				u = vcc_UintVal(tl);
 				ERRCHK(tl);
 				if (u == 0) {
 					VSB_printf(tl->sb,
 					    "The .weight must be higher "
-					    "than zero.");
-					vcc_ErrToken(tl, tl->t);
-					VSB_printf(tl->sb, " at\n");
-					vcc_ErrWhere(tl, tl->t);
+					    "than zero.\n");
+					vcc_ErrWhere(tl, t_x);
 					return;
 				}
 				Fc(tl, 0, "%s .weight = %u", first, u);



More information about the varnish-commit mailing list