[master] 2342a05d6 flexelint vmod_unix

Nils Goroll nils.goroll at uplex.de
Wed Nov 18 15:18:06 UTC 2020


commit 2342a05d6554f2d72ec1939b64eeb8c4ad7fdd6a
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Wed Nov 18 16:15:11 2020 +0100

    flexelint vmod_unix
    
    Solve comparison between unsigned and -1 by moving a cast to where we need it.
    
    the existing code already implied that a VCL_INT be large enough to hold
    uid_t / gid_t.

diff --git a/lib/libvmod_unix/vmod_unix.c b/lib/libvmod_unix/vmod_unix.c
index d7b882693..0dfbd5ae2 100644
--- a/lib/libvmod_unix/vmod_unix.c
+++ b/lib/libvmod_unix/vmod_unix.c
@@ -123,16 +123,16 @@ VCL_STRING							\
 vmod_##func(VRT_CTX)						\
 {								\
 	struct type *s;						\
-	id##_t i;						\
+	VCL_INT ret;						\
 	VCL_STRING name;					\
 								\
 	CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);			\
-	i = (id##_t) vmod_##id(ctx);				\
-	if (i == -1)						\
+	ret = vmod_##id(ctx);					\
+	if (ret == -1)						\
 		return (NULL);					\
 								\
 	errno = 0;						\
-	s = get(i);						\
+	s = get((id##_t) ret);					\
 	if (s == NULL) {					\
 		ERRNOCREDS(ctx);				\
 		return (NULL);					\


More information about the varnish-commit mailing list