Mailing List Archive

[6.3] e1d857150 Fix vrt_priv_dyncmp() to provide total ordering
commit e1d85715065a2d1684d06062a6c059d857c9cb10
Author: Nils Goroll <nils.goroll@uplex.de>
Date: Sat Jan 23 18:51:13 2021 +0100

Fix vrt_priv_dyncmp() to provide total ordering

Fixes #3505, see ticket for detailed explanation.

diff --git a/bin/varnishd/cache/cache_vrt_priv.c b/bin/varnishd/cache/cache_vrt_priv.c
index 76152cbf3..ad91c01b0 100644
--- a/bin/varnishd/cache/cache_vrt_priv.c
+++ b/bin/varnishd/cache/cache_vrt_priv.c
@@ -96,9 +96,13 @@ VRTPRIV_init(struct vrt_privs *privs)
static inline int
vrt_priv_dyncmp(const struct vrt_priv *vp1, const struct vrt_priv *vp2)
{
- if (vp1->vmod_id < vp2->vmod_id || vp1->id < vp2->id)
+ if (vp1->vmod_id < vp2->vmod_id)
return (-1);
- if (vp1->vmod_id > vp2->vmod_id || vp1->id > vp2->id)
+ if (vp1->vmod_id > vp2->vmod_id)
+ return (1);
+ if (vp1->id < vp2->id)
+ return (-1);
+ if (vp1->id > vp2->id)
return (1);
return (0);
}
_______________________________________________
varnish-commit mailing list
varnish-commit@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-commit