diff options
author | Philip Guenther <guenther@cvs.openbsd.org> | 2016-08-09 02:25:36 +0000 |
---|---|---|
committer | Philip Guenther <guenther@cvs.openbsd.org> | 2016-08-09 02:25:36 +0000 |
commit | 76093549a56e2aed50d99915a84892f888cd1f34 (patch) | |
tree | fa1a6ae232f0e554f7455d1735e790f5d9673b4a /regress | |
parent | df5c50b4de6fe61587aa6f1b73b69f8c84454cea (diff) |
When interrupted, connect() should leave the socket connecting in the
background, similar to a non-blocking socket. Return EALREADY whenever
already connecting, not just for non-blocking sockets. Fix from {Free,Net}BSD
Prompted by a report from Michael Reed (m.reed (at) mykolab.com)
ok millert@
Diffstat (limited to 'regress')
-rw-r--r-- | regress/lib/libpthread/restart/connect/connect.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/regress/lib/libpthread/restart/connect/connect.c b/regress/lib/libpthread/restart/connect/connect.c index dfa62040a47..e1ef9ac2830 100644 --- a/regress/lib/libpthread/restart/connect/connect.c +++ b/regress/lib/libpthread/restart/connect/connect.c @@ -1,4 +1,4 @@ -/* $OpenBSD: connect.c,v 1.1 2011/09/18 16:36:58 fgsch Exp $ */ +/* $OpenBSD: connect.c,v 1.2 2016/08/09 02:25:35 guenther Exp $ */ /* * Federico G. Schwindt <fgsch@openbsd.org>, 2011. Public Domain. */ @@ -30,7 +30,10 @@ thr_connect(void *arg) sa.sin_port = htons(23); sa.sin_addr.s_addr = htonl(0xc7b98903); /* cvs.openbsd.org */ ASSERT(connect(s, (struct sockaddr *)&sa, sizeof(sa)) == -1); - return ((caddr_t)NULL + errno); + int err = errno; + ASSERT(connect(s, (struct sockaddr *)&sa, sizeof(sa)) == -1); + ASSERT(errno == EALREADY); + return ((caddr_t)NULL + err); } int |