[master] ed93bc55c vut: Don't read VSL from stdin in daemon mode
Dridi Boukelmoune
dridi.boukelmoune at gmail.com
Mon Nov 29 16:12:08 UTC 2021
commit ed93bc55cc9ec69ecebb753104c747616b424e88
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date: Tue Nov 23 09:53:11 2021 +0100
vut: Don't read VSL from stdin in daemon mode
diff --git a/include/vut_options.h b/include/vut_options.h
index ad9e59a71..14eb0699e 100644
--- a/include/vut_options.h
+++ b/include/vut_options.h
@@ -93,7 +93,9 @@
#define VUT_OPT_r \
VOPT("r:", "[-r <filename>]", "Binary file input", \
"Read log in binary file format from this file. The file" \
- " can be created with ``varnishlog -w filename``." \
+ " can be created with ``varnishlog -w filename``. If the" \
+ " filename is -, logs are read from the standard input." \
+ " and cannot work as a daemon." \
)
#define VUT_OPT_t \
diff --git a/lib/libvarnishapi/vut.c b/lib/libvarnishapi/vut.c
index 7c275102e..42839da0c 100644
--- a/lib/libvarnishapi/vut.c
+++ b/lib/libvarnishapi/vut.c
@@ -302,6 +302,9 @@ VUT_Setup(struct VUT *vut)
(vut->r_arg == NULL ? 0 : 2) > 2)
VUT_Error(vut, 1, "Only one of -n and -r options may be used");
+ if (vut->r_arg != NULL && !strcmp(vut->r_arg, "-") && vut->D_opt)
+ VUT_Error(vut, 1, "Daemon cannot read from stdin");
+
/* Create and validate the query expression */
vut->vslq = VSLQ_New(vut->vsl, NULL,
(enum VSL_grouping_e)vut->g_arg, vut->q_arg);
More information about the varnish-commit
mailing list