+/* Licensed under BSD-MIT - see LICENSE file for details */
#include <ccan/net/net.h>
-#include <ccan/noerr/noerr.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <poll.h>
#include <fcntl.h>
#include <errno.h>
#include <stdbool.h>
+#include <netinet/in.h>
struct addrinfo *net_client_lookup(const char *hostname,
const char *service,
int net_connect(const struct addrinfo *addrinfo)
{
- int sockfd = -1;
+ int sockfd = -1, saved_errno;
unsigned int i, num;
const struct addrinfo *ipv4 = NULL, *ipv6 = NULL;
const struct addrinfo *addr[MAX_PROTOS];
sockfd = pfd[i].fd;
out:
+ saved_errno = errno;
for (i = 0; i < num; i++)
if (pfd[i].fd != sockfd)
- close_noerr(pfd[i].fd);
+ close(pfd[i].fd);
+ errno = saved_errno;
return sockfd;
}