[master] 3c87f32a3 for compiling VCLs, truncation is not an error

Nils Goroll nils.goroll at uplex.de
Mon Dec 16 14:09:07 UTC 2019


commit 3c87f32a341ce14a28f34067c29ef428466f2a48
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Mon Dec 16 14:57:09 2019 +0100

    for compiling VCLs, truncation is not an error

diff --git a/bin/varnishd/mgt/mgt_main.c b/bin/varnishd/mgt/mgt_main.c
index 1f920a100..77e2039a5 100644
--- a/bin/varnishd/mgt/mgt_main.c
+++ b/bin/varnishd/mgt/mgt_main.c
@@ -174,7 +174,7 @@ usage(void)
 static void
 cli_check(const struct cli *cli)
 {
-	if (cli->result == CLIS_OK) {
+	if (cli->result == CLIS_OK || cli->result == CLIS_TRUNCATED) {
 		AZ(VSB_finish(cli->sb));
 		if (VSB_len(cli->sb) > 0)
 			fprintf(stderr, "Warnings:\n%s\n", VSB_data(cli->sb));
@@ -804,7 +804,9 @@ main(int argc, char * const *argv)
 			fprintf(stderr, "%s\n", VSB_data(cli->sb));
 			VSB_clear(cli->sb);
 		}
-		exit(cli->result == CLIS_OK ? 0 : 2);
+		if (cli->result == CLIS_OK || cli->result == CLIS_TRUNCATED)
+			exit(0);
+		exit(2);
 	} else {
 		while (!VTAILQ_EMPTY(&f_args)) {
 			fa = VTAILQ_FIRST(&f_args);
diff --git a/bin/varnishd/mgt/mgt_vcl.c b/bin/varnishd/mgt/mgt_vcl.c
index 81751b8ca..cc372d2b8 100644
--- a/bin/varnishd/mgt/mgt_vcl.c
+++ b/bin/varnishd/mgt/mgt_vcl.c
@@ -458,7 +458,7 @@ mgt_new_vcl(struct cli *cli, const char *vclname, const char *vclsrc,
 	if (active_vcl == NULL)
 		active_vcl = vp;
 
-	if (cli->result == CLIS_OK &&
+	if ((cli->result == CLIS_OK || cli->result == CLIS_TRUNCATED) &&
 	    vcl_count > mgt_param.max_vcl &&
 	    mgt_param.max_vcl_handling == 1) {
 		VCLI_Out(cli, "%d VCLs loaded\n", vcl_count);


More information about the varnish-commit mailing list