[master] 9f33508 Fix crash under MacOS while investigating #2332

Federico G. Schwindt fgsch at lodoss.net
Wed Jun 7 10:38:06 CEST 2017


commit 9f335089c5d2b8b8a45e662dd8f3d8b6f41dec71
Author: Federico G. Schwindt <fgsch at lodoss.net>
Date:   Sun Jun 4 16:28:16 2017 +0100

    Fix crash under MacOS while investigating #2332
    
    MacOS will return EINVAL under e.g. setsockopt if the connection was
    reset.

diff --git a/lib/libvarnish/vtcp.c b/lib/libvarnish/vtcp.c
index 941a90b..2a4c25f 100644
--- a/lib/libvarnish/vtcp.c
+++ b/lib/libvarnish/vtcp.c
@@ -577,6 +577,13 @@ VTCP_Check(int a)
 	 */
 	if (errno == EINVAL || errno == ETIMEDOUT || errno == EPIPE)
 		return (1);
+#elif defined (__APPLE__)
+	/*
+	 * MacOS returns EINVAL if the other end unexpectedly reset
+	 * the connection.
+	 */
+	if (errno == EINVAL)
+		return (1);
 #endif
 	return (0);
 }



More information about the varnish-commit mailing list