[master] 31636e6 Even more strange error returns on Solaris

Poul-Henning Kamp phk at varnish-cache.org
Fri Oct 14 10:42:23 CEST 2011


commit 31636e68029195142aee28b5fefb00841b3990a2
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Fri Oct 14 08:42:04 2011 +0000

    Even more strange error returns on Solaris

diff --git a/include/vtcp.h b/include/vtcp.h
index 022f101..6ad260e 100644
--- a/include/vtcp.h
+++ b/include/vtcp.h
@@ -33,16 +33,24 @@
 #define VTCP_ADDRBUFSIZE		64
 #define VTCP_PORTBUFSIZE		16
 
+static inline int
+VTCP_Check(int a)
+{
+	if (a == 0)
+		return (1);
+	if (errno == ECONNRESET || errno == ENOTCONN)
+		return (1);
 #if (defined (__SVR4) && defined (__sun)) || defined (__NetBSD__)
-/*
- * Solaris returns EINVAL if the other end unexepectedly reset the
- * connection.  This is a bug in Solaris and documented behaviour on NetBSD.
- */
-#define VTCP_Check(a) ((a) == 0 || errno == ECONNRESET || errno == ENOTCONN \
-    || errno == EINVAL)
-#else
-#define VTCP_Check(a) ((a) == 0 || errno == ECONNRESET || errno == ENOTCONN)
+	/*
+	 * Solaris returns EINVAL if the other end unexepectedly reset the
+	 * connection.
+	 * This is a bug in Solaris and documented behaviour on NetBSD.
+	 */
+	if (errno == EINVAL || errno == ETIMEDOUT)
+		return (1);
 #endif
+	return (0);
+}
 
 #define VTCP_Assert(a) assert(VTCP_Check(a))
 



More information about the varnish-commit mailing list