From 658b89f5d8a8cc5580b015673e17419ba9433e79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juhani=20Krekel=C3=A4?= Date: Wed, 16 Feb 2022 19:41:29 +0200 Subject: [PATCH] fixup! Sortix patches --- af_unix.c | 2 +- dns.c | 2 +- links.h | 1 - select.c | 16 ---------------- 4 files changed, 2 insertions(+), 19 deletions(-) diff --git a/af_unix.c b/af_unix.c index 1a56529..d1c9ef5 100644 --- a/af_unix.c +++ b/af_unix.c @@ -218,7 +218,7 @@ attempt_connect: #if defined(SOL_SOCKET) && defined(SO_REUSEADDR) EINTRLOOP(rs, setsockopt(s_unix_fd, SOL_SOCKET, SO_REUSEADDR, (void *)&a1, sizeof a1)); #endif - rs = blocking_connect(s_unix_fd, &s_unix.s, s_unix_l); + EINTRLOOP(rs, connect(s_unix_fd, &s_unix.s, s_unix_l)); if (rs) { retry: /*debug("connect: %d, %s", errno, strerror(errno));*/ diff --git a/dns.c b/dns.c index ef94d9e..4d7484e 100644 --- a/dns.c +++ b/dns.c @@ -773,7 +773,7 @@ int ipv6_full_access(void) sin6.sin6_family = AF_INET6; sin6.sin6_port = htons(1024); memcpy(&sin6.sin6_addr.s6_addr, "\052\001\004\060\000\015\000\000\002\314\236\377\376\044\176\032", 16); - c = blocking_connect(h, (struct sockaddr *)(void *)&sin6, sizeof sin6); + EINTRLOOP(c, connect(h, (struct sockaddr *)(void *)&sin6, sizeof sin6)); EINTRLOOP(rs, close(h)); if (!c) return 1; #endif diff --git a/links.h b/links.h index 141023c..885d3a4 100644 --- a/links.h +++ b/links.h @@ -1140,7 +1140,6 @@ extern int terminate_loop; int can_write(int fd); int can_read(int fd); int can_read_timeout(int fd, int sec); -int blocking_connect(int fd, struct sockaddr *addr, socklen_t addrlen); int close_std_handle(int); void restore_std_handle(int, int); unsigned long select_info(int); diff --git a/select.c b/select.c index 3e24c5c..d92599b 100644 --- a/select.c +++ b/select.c @@ -125,22 +125,6 @@ int can_read(int fd) } -// PATCH: Handle connect not being restartable -int blocking_connect(int fd, struct sockaddr *addr, socklen_t addrlen) -{ - int connect_error; - socklen_t len = sizeof(connect_error); - - if (!connect(fd, addr, addrlen)) return 0; - if (errno != EINTR) return -1; - - can_do_io(fd, 1, -1); // Wait until connected/failed - getsockopt(fd, SOL_SOCKET, SO_ERROR, &connect_error, &len); - errno = connect_error; - return !connect_error ? 0 : -1; -} - - int close_std_handle(int std) { #ifndef DOS