[3.0] 2f53298 Even more strange error returns on Solaris
Tollef Fog Heen
tfheen at varnish-cache.org
Wed Oct 26 14:58:56 CEST 2011
commit 2f53298df0271815649ea010fdd1a6795b4cad5d
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/libvarnish.h b/include/libvarnish.h
index 157a64e..a4fd542 100644
--- a/include/libvarnish.h
+++ b/include/libvarnish.h
@@ -56,16 +56,24 @@ int SUB_run(struct vsb *sb, sub_func_f *func, void *priv, const char *name,
#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