From: phk Date: Mon, 7 Jul 2008 17:19:32 +0000 (+0000) Subject: Improve error messages related to syntax check of backend decls. X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c69809b122983844f8bd8b4aee05f30c16da5239;p=varnish Improve error messages related to syntax check of backend decls. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2881 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/lib/libvcl/vcc_backend.c b/varnish-cache/lib/libvcl/vcc_backend.c index f54d988b..3dc32e81 100644 --- a/varnish-cache/lib/libvcl/vcc_backend.c +++ b/varnish-cache/lib/libvcl/vcc_backend.c @@ -172,7 +172,7 @@ vcc_IsField(struct tokenlist *tl, struct token **t, struct fld_spec *fs) return; } -static void +static int vcc_FieldsOk(struct tokenlist *tl, const struct fld_spec *fs) { int ok = 1; @@ -180,14 +180,11 @@ vcc_FieldsOk(struct tokenlist *tl, const struct fld_spec *fs) for (; fs->name != NULL; fs++) { if (*fs->name == '!' && fs->found == NULL) { vsb_printf(tl->sb, - "Mandatory field .'%s' missing.\n", fs->name + 1); + "Mandatory field '%s' missing.\n", fs->name + 1); ok = 0; } } - if (!ok) { - vcc_ErrWhere(tl, tl->t); - } - return; + return (ok); } @@ -291,9 +288,7 @@ vcc_ParseBackendHost(struct tokenlist *tl, int *nbh, const struct token *name, c ExpectErr(tl, ';'); vcc_NextToken(tl); } - if (!tl->err) - vcc_FieldsOk(tl, fs); - if (tl->err) { + if (tl->err || !vcc_FieldsOk(tl, fs)) { vsb_printf(tl->sb, "\nIn backend host specfication starting at:\n"); vcc_ErrWhere(tl, t_first);