r3602 - in branches/2.0/varnish-cache: bin/varnishtest/tests lib/libvcl
tfheen at projects.linpro.no
tfheen at projects.linpro.no
Thu Feb 5 11:29:18 CET 2009
Author: tfheen
Date: 2009-02-05 11:29:18 +0100 (Thu, 05 Feb 2009)
New Revision: 3602
Modified:
branches/2.0/varnish-cache/bin/varnishtest/tests/v00016.vtc
branches/2.0/varnish-cache/lib/libvcl/vcc_compile.c
branches/2.0/varnish-cache/lib/libvcl/vcc_fixed_token.c
Log:
Merge r3378 + 3389: Make sure the VCL we try to load is a regular file
Fixes #368
r3389 | phk | 2008-11-11 21:40:37 +0100 (ti., 11 nov. 2008) | 4 lines
Fix this test-case to not rely on being able to compile /dev/null
now that this is no longer possible.
Modified: branches/2.0/varnish-cache/bin/varnishtest/tests/v00016.vtc
===================================================================
--- branches/2.0/varnish-cache/bin/varnishtest/tests/v00016.vtc 2009-02-05 10:21:48 UTC (rev 3601)
+++ branches/2.0/varnish-cache/bin/varnishtest/tests/v00016.vtc 2009-02-05 10:29:18 UTC (rev 3602)
@@ -2,16 +2,20 @@
test "Various VCL compiler coverage tests"
+shell "true > /tmp/_varnishtest_empty_file"
+
varnish v1 -vcl {
backend b { .host = "127.0.0.1"; }
- include "/dev/null" ;
+ include "/tmp/_varnishtest_empty_file" ;
}
varnish v1 -badvcl {
backend b { .host = "127.0.0.1"; }
- include "/dev/null" |
+ include "/tmp/_varnishtest_empty_file" |
}
+shell "rm -f /tmp/_varnishtest_empty_file"
+
varnish v1 -badvcl {
backend b { .host = "127.0.0.1"; }
include <<
Modified: branches/2.0/varnish-cache/lib/libvcl/vcc_compile.c
===================================================================
--- branches/2.0/varnish-cache/lib/libvcl/vcc_compile.c 2009-02-05 10:21:48 UTC (rev 3601)
+++ branches/2.0/varnish-cache/lib/libvcl/vcc_compile.c 2009-02-05 10:29:18 UTC (rev 3602)
@@ -415,6 +415,11 @@
}
}
assert(0 == fstat(fd, &st));
+ if (! S_ISREG(st.st_mode)) {
+ vsb_printf(sb, "File '%s' is not a regular file\n", fn);
+ AZ(close(fd));
+ return (NULL);
+ }
f = malloc(st.st_size + 1);
assert(f != NULL);
i = read(fd, f, st.st_size);
Modified: branches/2.0/varnish-cache/lib/libvcl/vcc_fixed_token.c
===================================================================
--- branches/2.0/varnish-cache/lib/libvcl/vcc_fixed_token.c 2009-02-05 10:21:48 UTC (rev 3601)
+++ branches/2.0/varnish-cache/lib/libvcl/vcc_fixed_token.c 2009-02-05 10:29:18 UTC (rev 3602)
@@ -167,8 +167,8 @@
/* ../../include/vcl.h */
- vsb_cat(sb, "/*\n * $Id: vcc_gen_fixed_token.tcl 3588 2009-02-05 09");
- vsb_cat(sb, ":34:34Z tfheen $\n *\n * NB: This file is machine gen");
+ vsb_cat(sb, "/*\n * $Id: vcc_gen_fixed_token.tcl 3601 2009-02-05 10");
+ vsb_cat(sb, ":21:48Z tfheen $\n *\n * NB: This file is machine gen");
vsb_cat(sb, "erated, DO NOT EDIT!\n *\n * Edit vcc_gen_fixed_token.");
vsb_cat(sb, "tcl instead\n */\n\nstruct sess;\n");
vsb_cat(sb, "struct cli;\n\ntypedef void vcl_init_f(struct cli *);\n");
More information about the varnish-commit
mailing list