From 110eb817bdb2e5f14e08a2afbca42146291251a8 Mon Sep 17 00:00:00 2001 From: ptlomholt Date: Thu, 17 Jan 2019 11:05:35 -0800 Subject: openbsd,tcp: special handling of EINVAL on connect Map `EINVAL` to `ECONNREFUSED` and return error on the next tick. Fixes: https://github.com/libuv/libuv/issues/2155 PR-URL: https://github.com/libuv/libuv/pull/2154 Reviewed-By: Santiago Gimeno Reviewed-By: Colin Ihrig Reviewed-By: Ben Noordhuis --- src/unix/tcp.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/unix/tcp.c') diff --git a/src/unix/tcp.c b/src/unix/tcp.c index 2982851d..900839a9 100644 --- a/src/unix/tcp.c +++ b/src/unix/tcp.c @@ -235,12 +235,16 @@ int uv__tcp_connect(uv_connect_t* req, if (r == -1 && errno != 0) { if (errno == EINPROGRESS) ; /* not an error */ - else if (errno == ECONNREFUSED) - /* If we get a ECONNREFUSED wait until the next tick to report the - * error. Solaris wants to report immediately--other unixes want to - * wait. + else if (errno == ECONNREFUSED +#if defined(__OpenBSD__) + || errno == EINVAL +#endif + ) + /* If we get ECONNREFUSED (Solaris) or EINVAL (OpenBSD) wait until the + * next tick to report the error. Solaris and OpenBSD wants to report + * immediately -- other unixes want to wait. */ - handle->delayed_error = UV__ERR(errno); + handle->delayed_error = UV__ERR(ECONNREFUSED); else return UV__ERR(errno); } -- cgit v1.2.3