Mailing List Archive

[master] 0ee49a674 Polish after vmin_t() introduction
commit 0ee49a674f4e0832239246abba41679b846e56c0
Author: Nils Goroll <nils.goroll@uplex.de>
Date: Mon Nov 8 17:19:49 2021 +0100

Polish after vmin_t() introduction

Minor rewrite for clarity.

VSL lines are truncated, so the return value _is_ sufficiently checked.

Ref 519ead4a3a019e28c1e5b7c8eab87261760dd07c

diff --git a/bin/varnishd/cache/cache_shmlog.c b/bin/varnishd/cache/cache_shmlog.c
index 02ddbf922..7c0bbd49a 100644
--- a/bin/varnishd/cache/cache_shmlog.c
+++ b/bin/varnishd/cache/cache_shmlog.c
@@ -269,8 +269,8 @@ VSLv(enum VSL_tag_e tag, uint32_t vxid, const char *fmt, va_list ap)
if (strchr(fmt, '%') == NULL) {
vslr(tag, vxid, fmt, strlen(fmt) + 1);
} else {
- /* XXX: should probably check return value of vsnprintf */
- n = vmin_t(unsigned, vsnprintf(buf, mlen, fmt, ap), mlen - 1);
+ n = vsnprintf(buf, mlen, fmt, ap);
+ n = vmin_t(unsigned, n, mlen - 1);
buf[n++] = '\0'; /* NUL-terminated */
vslr(tag, vxid, buf, n);
}
_______________________________________________
varnish-commit mailing list
varnish-commit@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-commit