[6.0] 6590787f0 for compiling VCLs, truncation is not an error

Reza Naghibi reza at naghibi.com
Tue May 19 19:39:09 UTC 2020


commit 6590787f0e935161d3e99fb7b68dfbb4e593f976
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
    
    Conflicts:
        bin/varnishd/mgt/mgt_main.c

diff --git a/bin/varnishd/mgt/mgt_main.c b/bin/varnishd/mgt/mgt_main.c
index 2e0ee14f5..765efd39a 100644
--- a/bin/varnishd/mgt/mgt_main.c
+++ b/bin/varnishd/mgt/mgt_main.c
@@ -175,7 +175,10 @@ 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));
 		VSB_clear(cli->sb);
 		return;
 	}
@@ -798,7 +801,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 c0fadf475..5d7bab1a7 100644
--- a/bin/varnishd/mgt/mgt_vcl.c
+++ b/bin/varnishd/mgt/mgt_vcl.c
@@ -603,7 +603,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