[6.0] 4db89ddab Change VTCP_Check() to take a ssize_t

Reza Naghibi reza at naghibi.com
Thu Apr 22 15:55:06 UTC 2021


commit 4db89ddab334e0325682966011f6923452ea5555
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 a5431aba6..226f70165 100644
--- a/include/vtcp.h
+++ b/include/vtcp.h
@@ -35,7 +35,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 9f253dd56..13b1ab9ed 100644
--- a/lib/libvarnish/vtcp.c
+++ b/lib/libvarnish/vtcp.c
@@ -556,7 +556,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