[master] 30ec003dd Change VTCP_Check() to take a ssize_t

Martin Blix Grydeland martin at varnish-software.com
Mon Nov 9 15:13:08 UTC 2020


commit 30ec003dd8de69bf5881b848d7dd07414b1bc4e6
Author: Martin Blix Grydeland <martin at varnish-software.com>
Date:   Wed Oct 7 15:07:46 2020 +0200

    Change VTCP_Check() to take a ssize_t
    
    Since the input value is sometimes the result of a read()/write() call,
    avoid truncating the ssize_t value on calling it.

diff --git a/include/vtcp.h b/include/vtcp.h
index 05244f74b..c561c2567 100644
--- a/include/vtcp.h
+++ b/include/vtcp.h
@@ -37,7 +37,7 @@ struct suckaddr;
 #define VTCP_ADDRBUFSIZE		64
 #define VTCP_PORTBUFSIZE		16
 
-int VTCP_Check(int a);
+int VTCP_Check(ssize_t a);
 #define VTCP_Assert(a) assert(VTCP_Check(a))
 
 struct suckaddr *VTCP_my_suckaddr(int sock);
diff --git a/lib/libvarnish/vtcp.c b/lib/libvarnish/vtcp.c
index 53335aedf..7baee4b06 100644
--- a/lib/libvarnish/vtcp.c
+++ b/lib/libvarnish/vtcp.c
@@ -558,7 +558,7 @@ VTCP_check_hup(int sock)
  */
 
 int
-VTCP_Check(int a)
+VTCP_Check(ssize_t a)
 {
 	if (a == 0)
 		return (1);


More information about the varnish-commit mailing list