Commit 962fe5ac authored by Federico G. Schwindt's avatar Federico G. Schwindt Committed by Lasse Karstensen

Make std.syslog() work from vcl_{init,fini}

Related to #1924.
parent 8f465d36
varnishtest "Test std.log from vcl_{init,fini}" varnishtest "Test std.{log,syslog} from vcl_{init,fini}"
server s1 { server s1 {
rxreq rxreq
...@@ -10,10 +10,12 @@ varnish v1 -vcl+backend { ...@@ -10,10 +10,12 @@ varnish v1 -vcl+backend {
sub vcl_init { sub vcl_init {
std.log("init"); std.log("init");
std.syslog(8 + 7, "init");
} }
sub vcl_fini { sub vcl_fini {
std.log("fini"); std.log("fini");
std.syslog(8 + 7, "fini");
} }
} -start } -start
......
...@@ -243,6 +243,7 @@ AC_CHECK_FUNCS([nanosleep]) ...@@ -243,6 +243,7 @@ AC_CHECK_FUNCS([nanosleep])
AC_CHECK_FUNCS([setppriv]) AC_CHECK_FUNCS([setppriv])
AC_CHECK_FUNCS([fallocate]) AC_CHECK_FUNCS([fallocate])
AC_CHECK_FUNCS([closefrom]) AC_CHECK_FUNCS([closefrom])
AC_CHECK_FUNCS([vsyslog])
save_LIBS="${LIBS}" save_LIBS="${LIBS}"
LIBS="${PTHREAD_LIBS}" LIBS="${PTHREAD_LIBS}"
......
...@@ -163,14 +163,17 @@ vmod_syslog(VRT_CTX, VCL_INT fac, const char *fmt, ...) ...@@ -163,14 +163,17 @@ vmod_syslog(VRT_CTX, VCL_INT fac, const char *fmt, ...)
txt t; txt t;
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
u = WS_Reserve(ctx->ws, 0);
t.b = ctx->ws->f;
va_start(ap, fmt); va_start(ap, fmt);
t.e = VRT_StringList(ctx->ws->f, u, fmt, ap); if (ctx->ws != NULL) {
u = WS_Reserve(ctx->ws, 0);
t.b = ctx->ws->f;
t.e = VRT_StringList(ctx->ws->f, u, fmt, ap);
if (t.e != NULL)
syslog((int)fac, "%s", t.b);
WS_Release(ctx->ws, 0);
} else
vsyslog((int)fac, fmt, ap);
va_end(ap); va_end(ap);
if (t.e != NULL)
syslog((int)fac, "%s", t.b);
WS_Release(ctx->ws, 0);
} }
VCL_VOID __match_proto__(td_std_collect) VCL_VOID __match_proto__(td_std_collect)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment