[4.1] ef43067 Fix crash under MacOS while investigating #2332

PÃ¥l Hermunn Johansen hermunn at varnish-software.com
Fri Feb 23 15:52:07 UTC 2018


commit ef430670a5f2f11acb3d6d030844e4c4450370e2
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 d28b99c..79498c4 100644
--- a/lib/libvarnish/vtcp.c
+++ b/lib/libvarnish/vtcp.c
@@ -579,6 +579,13 @@ VTCP_Check(int a)
 	 */
 	if (errno == EINVAL || errno == ETIMEDOUT)
 		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