+#endif
+
+#if HAVE_VARNISH_V5
+ if (VSM_Attach(vd, STDERR_FILENO)) {
+ ERROR("varnish plugin: Cannot attach to varnish. %s", VSM_Error(vd));
+ VSC_Destroy(&vsc, vd);
+ VSM_Destroy(&vd);
+ return -1;
+ }
+
+ vsm_status = VSM_Status(vd);
+ if (vsm_status & ~(VSM_MGT_RUNNING|VSM_WRK_RUNNING)) {
+ ERROR("varnish plugin: Unable to get statistics.");
+ VSC_Destroy(&vsc, vd);
+ VSM_Destroy(&vd);
+ return -1;
+ }
+#endif