[master] 32574ab46 vsm: Pass VARNISH_DEFAULT_N to VSM_Arg()
Dridi Boukelmoune
dridi.boukelmoune at gmail.com
Sat May 25 05:02:05 UTC 2024
commit 32574ab4666173afc30fc0a072df7ae48c822f5d
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date: Sat May 25 06:53:23 2024 +0200
vsm: Pass VARNISH_DEFAULT_N to VSM_Arg()
It should be resolved like the argument of a -n option.
Refs 1d7cdaddab67d156f6a99b2d2a1089b3a1913275
diff --git a/lib/libvarnishapi/vsm.c b/lib/libvarnishapi/vsm.c
index 2561d1a1d..10faa5d74 100644
--- a/lib/libvarnishapi/vsm.c
+++ b/lib/libvarnishapi/vsm.c
@@ -743,6 +743,7 @@ VSM_Status(struct vsm *vd)
int
VSM_Attach(struct vsm *vd, int progress)
{
+ const char *def;
double t0;
unsigned u;
int i, n = 0;
@@ -754,12 +755,11 @@ VSM_Attach(struct vsm *vd, int progress)
else
t0 = VTIM_mono() + vd->patience;
- if (vd->wdname == NULL)
- REPLACE(vd->wdname, getenv("VARNISH_DEFAULT_N"));
-
if (vd->wdname == NULL) {
- /* Use default (hostname) */
- i = VSM_Arg(vd, 'n', "");
+ def = getenv("VARNISH_DEFAULT_N");
+ if (def == NULL)
+ def = ""; /* Use default (hostname) */
+ i = VSM_Arg(vd, 'n', def);
if (i < 0)
return (i);
AN(vd->wdname);
More information about the varnish-commit
mailing list