From a1f2631420b9981cc3acc663801d6bebd7315a4f Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 20 Nov 2022 07:14:38 +0000 Subject: Remove trailing whitespaces in *.c. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1905414 13f79535-47bb-0310-9956-ffa450edef68 --- network_io/unix/multicast.c | 12 ++++---- network_io/unix/sendrecv.c | 72 ++++++++++++++++++++++----------------------- network_io/unix/sockaddr.c | 68 +++++++++++++++++++++--------------------- network_io/unix/sockets.c | 36 +++++++++++------------ network_io/unix/sockopt.c | 24 +++++++-------- 5 files changed, 106 insertions(+), 106 deletions(-) (limited to 'network_io/unix') diff --git a/network_io/unix/multicast.c b/network_io/unix/multicast.c index a8c85ce69..98d949818 100644 --- a/network_io/unix/multicast.c +++ b/network_io/unix/multicast.c @@ -47,15 +47,15 @@ static void fill_mip_v4(struct ip_mreq *mip, apr_sockaddr_t *mcast, static unsigned int find_if_index(const apr_sockaddr_t *iface) { unsigned int index = 0; -#if defined(HAVE_GETIFADDRS) && APR_HAVE_IFADDRS_H && APR_HAVE_IPV6 +#if defined(HAVE_GETIFADDRS) && APR_HAVE_IFADDRS_H && APR_HAVE_IPV6 struct ifaddrs *ifp, *ifs; /** - * TODO: getifaddrs is only portable to *BSD and OS X. Using ioctl + * TODO: getifaddrs is only portable to *BSD and OS X. Using ioctl * and SIOCGIFCONF is needed for Linux/Solaris support. - * - * There is a wrapper that takes the messy ioctl interface into - * getifaddrs. The license is acceptable, but, It is a fairly large + * + * There is a wrapper that takes the messy ioctl interface into + * getifaddrs. The license is acceptable, but, It is a fairly large * chunk of code. */ if (getifaddrs(&ifs) != 0) { @@ -129,7 +129,7 @@ static apr_status_t do_mcast(int type, apr_socket_t *sock, #ifdef GROUP_FILTER_SIZE if (sock_is_ipv4(sock)) { ip_proto = IPPROTO_IP; - } + } #if APR_HAVE_IPV6 else if (sock_is_ipv6(sock)) { ip_proto = IPPROTO_IPV6; diff --git a/network_io/unix/sendrecv.c b/network_io/unix/sendrecv.c index 6721a66e9..34e4b8e45 100644 --- a/network_io/unix/sendrecv.c +++ b/network_io/unix/sendrecv.c @@ -27,11 +27,11 @@ #include #endif -apr_status_t apr_socket_send(apr_socket_t *sock, const char *buf, +apr_status_t apr_socket_send(apr_socket_t *sock, const char *buf, apr_size_t *len) { apr_ssize_t rv; - + if (sock->options & APR_INCOMPLETE_WRITE) { sock->options &= ~APR_INCOMPLETE_WRITE; goto do_select; @@ -41,7 +41,7 @@ apr_status_t apr_socket_send(apr_socket_t *sock, const char *buf, rv = write(sock->socketdes, buf, (*len)); } while (rv == -1 && errno == EINTR); - while (rv == -1 && (errno == EAGAIN || errno == EWOULDBLOCK) + while (rv == -1 && (errno == EAGAIN || errno == EWOULDBLOCK) && (sock->timeout > 0)) { apr_status_t arv; do_select: @@ -116,8 +116,8 @@ apr_status_t apr_socket_sendto(apr_socket_t *sock, apr_sockaddr_t *where, apr_ssize_t rv; do { - rv = sendto(sock->socketdes, buf, (*len), flags, - (const struct sockaddr*)&where->sa, + rv = sendto(sock->socketdes, buf, (*len), flags, + (const struct sockaddr*)&where->sa, where->salen); } while (rv == -1 && errno == EINTR); @@ -144,15 +144,15 @@ apr_status_t apr_socket_sendto(apr_socket_t *sock, apr_sockaddr_t *where, } apr_status_t apr_socket_recvfrom(apr_sockaddr_t *from, apr_socket_t *sock, - apr_int32_t flags, char *buf, + apr_int32_t flags, char *buf, apr_size_t *len) { apr_ssize_t rv; - + from->salen = sizeof(from->sa); do { - rv = recvfrom(sock->socketdes, buf, (*len), flags, + rv = recvfrom(sock->socketdes, buf, (*len), flags, (struct sockaddr*)&from->sa, &from->salen); } while (rv == -1 && errno == EINTR); @@ -207,7 +207,7 @@ apr_status_t apr_socket_sendv(apr_socket_t * sock, const struct iovec *vec, rv = writev(sock->socketdes, vec, nvec); } while (rv == -1 && errno == EINTR); - while ((rv == -1) && (errno == EAGAIN || errno == EWOULDBLOCK) + while ((rv == -1) && (errno == EAGAIN || errno == EWOULDBLOCK) && (sock->timeout > 0)) { apr_status_t arv; do_select: @@ -279,12 +279,12 @@ apr_status_t apr_socket_sendfile(apr_socket_t *sock, apr_file_t *file, /* 64-bit apr_off_t but no sendfile64(): fail if trying to send * past the 2Gb limit. */ off_t off; - + if ((apr_int64_t)*offset + bytes_to_send > INT_MAX) { *len = 0; return EINVAL; } - + off = *offset; #else @@ -325,8 +325,8 @@ apr_status_t apr_socket_sendfile(apr_socket_t *sock, apr_file_t *file, return arv; } - /* If this was a partial write and we aren't doing timeouts, - * return now with the partial byte count; this is a non-blocking + /* If this was a partial write and we aren't doing timeouts, + * return now with the partial byte count; this is a non-blocking * socket. */ total_hdrbytes = 0; @@ -353,7 +353,7 @@ apr_status_t apr_socket_sendfile(apr_socket_t *sock, apr_file_t *file, bytes_to_send); /* number of bytes to send */ } while (rv == -1 && errno == EINTR); - while ((rv == -1) && (errno == EAGAIN || errno == EWOULDBLOCK) + while ((rv == -1) && (errno == EAGAIN || errno == EWOULDBLOCK) && (sock->timeout > 0)) { do_select: arv = apr_wait_for_io_or_timeout(NULL, sock, 0); @@ -388,8 +388,8 @@ do_select: arv = APR_SUCCESS; } if (rv > 0) { - - /* If this was a partial write, return now with the + + /* If this was a partial write, return now with the * partial byte count; this is a non-blocking socket. */ @@ -400,7 +400,7 @@ do_select: } else { /* If the file got smaller mid-request, eventually the offset - * becomes equal to the new file size and the kernel returns 0. + * becomes equal to the new file size and the kernel returns 0. * Make this an error so the caller knows to log something and * exit. */ @@ -446,8 +446,8 @@ apr_status_t apr_socket_sendfile(apr_socket_t *sock, apr_file_t *file, hdtr = &no_hdtr; } - /* OS X can send the headers/footers as part of the system call, - * but how it counts bytes isn't documented properly. We use + /* OS X can send the headers/footers as part of the system call, + * but how it counts bytes isn't documented properly. We use * apr_socket_sendv() instead. */ if (hdtr->numheaders > 0) { @@ -566,9 +566,9 @@ apr_status_t apr_socket_sendfile(apr_socket_t * sock, apr_file_t * file, #if defined(__FreeBSD_version) && __FreeBSD_version < 460001 else if (hdtr->numheaders) { - /* On early versions of FreeBSD sendfile, the number of bytes to send - * must include the length of the headers. Don't look at the man page - * for this :( Instead, look at the logic in + /* On early versions of FreeBSD sendfile, the number of bytes to send + * must include the length of the headers. Don't look at the man page + * for this :( Instead, look at the logic in * src/sys/kern/uipc_syscalls::sendfile(). * * This was fixed in the middle of 4.6-STABLE @@ -635,7 +635,7 @@ apr_status_t apr_socket_sendfile(apr_socket_t * sock, apr_file_t * file, } *len += nbytes; } - } + } else { /* just trailer bytes... use writev() */ @@ -673,7 +673,7 @@ apr_status_t apr_socket_sendfile(apr_socket_t * sock, apr_file_t * file, /* ssize_t sendfile(int s, int fd, off_t offset, size_t nbytes, * const struct iovec *hdtrl, int flags); * - * nbytes is the number of bytes to send just from the file; as with FreeBSD, + * nbytes is the number of bytes to send just from the file; as with FreeBSD, * if nbytes == 0, the rest of the file (from offset) is sent */ @@ -728,7 +728,7 @@ apr_status_t apr_socket_sendfile(apr_socket_t *sock, apr_file_t *file, headerlen = 0; for (i = 0; i < hdtr->numheaders; i++) { headerlen += hdtr->headers[i].iov_len; - } + } /* XXX: BUHHH? wow, what a memory leak! */ headerbuf = hdtrarray[0].iov_base = apr_palloc(sock->pool, headerlen); @@ -780,7 +780,7 @@ apr_status_t apr_socket_sendfile(apr_socket_t *sock, apr_file_t *file, } } while (rc == -1 && errno == EINTR); - while ((rc == -1) && (errno == EAGAIN || errno == EWOULDBLOCK) + while ((rc == -1) && (errno == EAGAIN || errno == EWOULDBLOCK) && (sock->timeout > 0)) { apr_status_t arv = apr_wait_for_io_or_timeout(NULL, sock, 0); @@ -927,7 +927,7 @@ apr_status_t apr_socket_sendfile(apr_socket_t * sock, apr_file_t * file, flags); /* flags */ } while (rv == -1 && errno == EINTR); - while ((rv == -1) && (errno == EAGAIN || errno == EWOULDBLOCK) + while ((rv == -1) && (errno == EAGAIN || errno == EWOULDBLOCK) && (sock->timeout > 0)) { do_select: arv = apr_wait_for_io_or_timeout(NULL, sock, 0); @@ -957,7 +957,7 @@ do_select: } if ((sock->timeout > 0) - && (parms.bytes_sent + && (parms.bytes_sent < (parms.file_bytes + parms.header_length + parms.trailer_length))) { sock->options |= APR_INCOMPLETE_WRITE; } @@ -970,7 +970,7 @@ do_select: * hang the machine and the only way to fix it is a reboot. */ #elif defined(HAVE_SENDFILEV) -/* Solaris 8's sendfilev() interface +/* Solaris 8's sendfilev() interface * * SFV_FD_SELF refers to our memory space. * @@ -1027,7 +1027,7 @@ apr_status_t apr_socket_sendfile(apr_socket_t *sock, apr_file_t *file, sfv[curvec].sfv_fd = file->filedes; sfv[curvec].sfv_flag = 0; sfv[curvec].sfv_off = *offset; - sfv[curvec].sfv_len = *len; + sfv[curvec].sfv_len = *len; requested_len += sfv[curvec].sfv_len; curvec++; @@ -1056,14 +1056,14 @@ apr_status_t apr_socket_sendfile(apr_socket_t *sock, apr_file_t *file, return arv; } } - + /* Actually do the sendfilev * * Solaris may return -1/EAGAIN even if it sent bytes on a non-block sock. * - * If no bytes were originally sent (nbytes == 0) and we are on a TIMEOUT - * socket (which as far as the OS is concerned is a non-blocking socket), - * we want to retry after waiting for the other side to read the data (as + * If no bytes were originally sent (nbytes == 0) and we are on a TIMEOUT + * socket (which as far as the OS is concerned is a non-blocking socket), + * we want to retry after waiting for the other side to read the data (as * determined by poll). Once it is clear to send, we want to retry * sending the sendfilevec_t once more. */ @@ -1087,7 +1087,7 @@ apr_status_t apr_socket_sendfile(apr_socket_t *sock, apr_file_t *file, return t; } - arv = 1; + arv = 1; repeat = 1; } } @@ -1115,7 +1115,7 @@ apr_status_t apr_socket_sendfile(apr_socket_t *sock, apr_file_t *file, } #else #error APR has detected sendfile on your system, but nobody has written a -#error version of it for APR yet. To get past this, either write +#error version of it for APR yet. To get past this, either write #error apr_socket_sendfile or change APR_HAS_SENDFILE in apr.h to 0. #endif /* __linux__, __FreeBSD__, __DragonFly__, __HPUX__, _AIX, __MVS__, Tru64/OSF1 */ diff --git a/network_io/unix/sockaddr.c b/network_io/unix/sockaddr.c index 16712fec2..d3bce601c 100644 --- a/network_io/unix/sockaddr.c +++ b/network_io/unix/sockaddr.c @@ -122,7 +122,7 @@ APR_DECLARE(apr_status_t) apr_sockaddr_ip_getbuf(char *buf, apr_size_t buflen, } #if APR_HAVE_IPV6 - if (sockaddr->family == AF_INET6 + if (sockaddr->family == AF_INET6 && IN6_IS_ADDR_V4MAPPED((struct in6_addr *)sockaddr->ipaddr_ptr) && buflen > strlen("::ffff:")) { /* This is an IPv4-mapped IPv6 address; drop the leading @@ -153,7 +153,7 @@ APR_DECLARE(apr_status_t) apr_sockaddr_ip_getbuf(char *buf, apr_size_t buflen, *p++ = '%'; memcpy(p, scbuf, strlen(scbuf) + 1); } - } + } #endif /* HAVE_IF_INDEXTONAME */ #endif /* APR_HAVE_IPV6 */ @@ -283,9 +283,9 @@ APR_DECLARE(apr_status_t) apr_parse_addr_port(char **addr, /* now handle the hostname */ addrlen = lastchar - str + 1; -/* XXX we don't really have to require APR_HAVE_IPV6 for this; +/* XXX we don't really have to require APR_HAVE_IPV6 for this; * just pass char[] for ipaddr (so we don't depend on struct in6_addr) - * and always define APR_INET6 + * and always define APR_INET6 */ #if APR_HAVE_IPV6 if (*str == '[') { @@ -320,10 +320,10 @@ APR_DECLARE(apr_status_t) apr_parse_addr_port(char **addr, return APR_EINVAL; } } - else + else #endif { - /* XXX If '%' is not a valid char in a DNS name, we *could* check + /* XXX If '%' is not a valid char in a DNS name, we *could* check * for bogus scope ids first. */ *addr = apr_pstrmemdup(p, str, addrlen); @@ -335,13 +335,13 @@ APR_DECLARE(apr_status_t) apr_parse_addr_port(char **addr, static apr_status_t call_resolver(apr_sockaddr_t **sa, const char *hostname, apr_int32_t family, - apr_port_t port, apr_int32_t flags, + apr_port_t port, apr_int32_t flags, apr_pool_t *p) { struct addrinfo hints, *ai, *ai_list; apr_sockaddr_t *prev_sa; int error; - char *servname = NULL; + char *servname = NULL; memset(&hints, 0, sizeof(hints)); hints.ai_family = family; @@ -356,16 +356,16 @@ static apr_status_t call_resolver(apr_sockaddr_t **sa, #endif #ifdef __MVS__ - /* z/OS will not return IPv4 address under AF_UNSPEC if any IPv6 results - * are returned, w/o AI_ALL. + /* z/OS will not return IPv4 address under AF_UNSPEC if any IPv6 results + * are returned, w/o AI_ALL. */ - if (family == APR_UNSPEC) { + if (family == APR_UNSPEC) { hints.ai_flags |= AI_ALL; } #endif if(hostname == NULL) { -#ifdef AI_PASSIVE +#ifdef AI_PASSIVE /* If hostname is NULL, assume we are trying to bind to all * interfaces. */ hints.ai_flags |= AI_PASSIVE; @@ -426,11 +426,11 @@ static apr_status_t call_resolver(apr_sockaddr_t **sa, if (error == EAI_SYSTEM) { return errno ? errno : APR_EGENERAL; } - else + else { /* issues with representing this with APR's error scheme: - * glibc uses negative values for these numbers, perhaps so - * they don't conflict with h_errno values... Tru64 uses + * glibc uses negative values for these numbers, perhaps so + * they don't conflict with h_errno values... Tru64 uses * positive values which conflict with h_errno values */ #if defined(NEGATIVE_EAI) @@ -491,9 +491,9 @@ static apr_status_t call_resolver(apr_sockaddr_t **sa, return APR_SUCCESS; } -static apr_status_t find_addresses(apr_sockaddr_t **sa, +static apr_status_t find_addresses(apr_sockaddr_t **sa, const char *hostname, apr_int32_t family, - apr_port_t port, apr_int32_t flags, + apr_port_t port, apr_int32_t flags, apr_pool_t *p) { if (flags & APR_IPV4_ADDR_OK) { @@ -525,9 +525,9 @@ static apr_status_t find_addresses(apr_sockaddr_t **sa, #else /* end of HAVE_GETADDRINFO code */ -static apr_status_t find_addresses(apr_sockaddr_t **sa, +static apr_status_t find_addresses(apr_sockaddr_t **sa, const char *hostname, apr_int32_t family, - apr_port_t port, apr_int32_t flags, + apr_port_t port, apr_int32_t flags, apr_pool_t *p) { struct hostent *hp; @@ -573,7 +573,7 @@ static apr_status_t find_addresses(apr_sockaddr_t **sa, #else #if defined(GETHOSTBYNAME_R_GLIBC2) /* Linux glibc2+ */ - gethostbyname_r(hostname, &hs, tmp, GETHOSTBYNAME_BUFLEN - 1, + gethostbyname_r(hostname, &hs, tmp, GETHOSTBYNAME_BUFLEN - 1, &hp, &hosterror); #else /* Solaris, Irix et alia */ @@ -632,7 +632,7 @@ static apr_status_t find_addresses(apr_sockaddr_t **sa, #endif /* end of !HAVE_GETADDRINFO code */ APR_DECLARE(apr_status_t) apr_sockaddr_info_get(apr_sockaddr_t **sa, - const char *hostname, + const char *hostname, apr_int32_t family, apr_port_t port, apr_int32_t flags, apr_pool_t *p) { @@ -791,7 +791,7 @@ APR_DECLARE(apr_status_t) apr_getnameinfo(char **hostname, return errno + APR_OS_START_SYSERR; } } - else + else #endif { #if defined(NEGATIVE_EAI) @@ -800,7 +800,7 @@ APR_DECLARE(apr_status_t) apr_getnameinfo(char **hostname, return rc + APR_OS_START_EAIERR; /* return the EAI_ error */ } } - *hostname = sockaddr->hostname = apr_pstrdup(sockaddr->pool, + *hostname = sockaddr->hostname = apr_pstrdup(sockaddr->pool, tmphostname); return APR_SUCCESS; #else @@ -816,18 +816,18 @@ APR_DECLARE(apr_status_t) apr_getnameinfo(char **hostname, #if defined(GETHOSTBYNAME_R_HOSTENT_DATA) /* AIX, HP/UX, D/UX et alia */ - gethostbyaddr_r((char *)&sockaddr->sa.sin.sin_addr, + gethostbyaddr_r((char *)&sockaddr->sa.sin.sin_addr, sizeof(struct in_addr), AF_INET, &hs, &hd); hptr = &hs; #else #if defined(GETHOSTBYNAME_R_GLIBC2) /* Linux glibc2+ */ - gethostbyaddr_r((char *)&sockaddr->sa.sin.sin_addr, + gethostbyaddr_r((char *)&sockaddr->sa.sin.sin_addr, sizeof(struct in_addr), AF_INET, &hs, tmp, GETHOSTBYNAME_BUFLEN - 1, &hptr, &hosterror); #else /* Solaris, Irix et alia */ - hptr = gethostbyaddr_r((char *)&sockaddr->sa.sin.sin_addr, + hptr = gethostbyaddr_r((char *)&sockaddr->sa.sin.sin_addr, sizeof(struct in_addr), AF_INET, &hs, tmp, GETHOSTBYNAME_BUFLEN, &hosterror); #endif /* !defined(GETHOSTBYNAME_R_GLIBC2) */ @@ -838,7 +838,7 @@ APR_DECLARE(apr_status_t) apr_getnameinfo(char **hostname, #endif /* !defined(GETHOSTBYNAME_R_HOSTENT_DATA) */ #else struct hostent *hptr; - hptr = gethostbyaddr((char *)&sockaddr->sa.sin.sin_addr, + hptr = gethostbyaddr((char *)&sockaddr->sa.sin.sin_addr, sizeof(struct in_addr), AF_INET); #endif @@ -1046,7 +1046,7 @@ static apr_status_t parse_ip(apr_ipsubnet_t *ipsub, const char *ipstr, int netwo /* supported flavors of IP: * * . IPv6 numeric address string (e.g., "fe80::1") - * + * * IMPORTANT: Don't store IPv4-mapped IPv6 address as an IPv6 address. * * . IPv4 numeric address string (e.g., "127.0.0.1") @@ -1093,7 +1093,7 @@ static int looks_like_ip(const char *ipstr) if (strlen(ipstr) == 0) { return 0; } - + if (strchr(ipstr, ':')) { /* definitely not a hostname; assume it is intended to be an IPv6 address */ return 1; @@ -1118,14 +1118,14 @@ static void fix_subnet(apr_ipsubnet_t *ipsub) } /* be sure not to store any IPv4 address as a v4-mapped IPv6 address */ -APR_DECLARE(apr_status_t) apr_ipsubnet_create(apr_ipsubnet_t **ipsub, const char *ipstr, +APR_DECLARE(apr_status_t) apr_ipsubnet_create(apr_ipsubnet_t **ipsub, const char *ipstr, const char *mask_or_numbits, apr_pool_t *p) { apr_status_t rv; char *endptr; long bits, maxbits = 32; - /* filter out stuff which doesn't look remotely like an IP address; this helps + /* filter out stuff which doesn't look remotely like an IP address; this helps * callers like mod_access which have a syntax allowing hostname or IP address; * APR_EINVAL tells the caller that it was probably not intended to be an IP * address @@ -1227,7 +1227,7 @@ APR_DECLARE(apr_status_t) apr_sockaddr_zone_set(apr_sockaddr_t *sa, return APR_ENOTIMPL; #else unsigned int idx; - + if (sa->family != APR_INET6 || !IN6_IS_ADDR_LINKLOCAL((struct in6_addr *)sa->ipaddr_ptr)) { return APR_EBADIP; @@ -1266,7 +1266,7 @@ APR_DECLARE(apr_status_t) apr_sockaddr_zone_get(const apr_sockaddr_t *sa, #else if (sa->family != APR_INET6 || !sa->sa.sin6.sin6_scope_id) { return APR_EBADIP; - } + } if (name) { char *buf = apr_palloc(p, IF_NAMESIZE); @@ -1276,7 +1276,7 @@ APR_DECLARE(apr_status_t) apr_sockaddr_zone_get(const apr_sockaddr_t *sa, } if (id) *id = sa->sa.sin6.sin6_scope_id; - + return APR_SUCCESS; #endif } diff --git a/network_io/unix/sockets.c b/network_io/unix/sockets.c index e95ce2c7d..be992d4f7 100644 --- a/network_io/unix/sockets.c +++ b/network_io/unix/sockets.c @@ -50,7 +50,7 @@ static apr_status_t socket_cleanup(void *sock) /* XXX: Check for return values ? */ unlink(thesocket->local_addr->hostname); } -#endif +#endif if (close(sd) == 0) { return APR_SUCCESS; } @@ -200,9 +200,9 @@ apr_status_t apr_socket_create(apr_socket_t **new, int ofamily, int type, socket_child_cleanup); return APR_SUCCESS; -} +} -apr_status_t apr_socket_shutdown(apr_socket_t *thesocket, +apr_status_t apr_socket_shutdown(apr_socket_t *thesocket, apr_shutdown_how_e how) { return (shutdown(thesocket->socketdes, how) == -1) ? errno : APR_SUCCESS; @@ -215,7 +215,7 @@ apr_status_t apr_socket_close(apr_socket_t *thesocket) apr_status_t apr_socket_bind(apr_socket_t *sock, apr_sockaddr_t *sa) { - if (bind(sock->socketdes, + if (bind(sock->socketdes, (struct sockaddr *)&sa->sa, sa->salen) == -1) { return errno; } @@ -275,7 +275,7 @@ apr_status_t apr_socket_accept(apr_socket_t **new, apr_socket_t *sock, return errno; } #ifdef TPF - if (s == 0) { + if (s == 0) { /* 0 is an invalid socket for TPF */ return APR_EINTR; } @@ -304,8 +304,8 @@ apr_status_t apr_socket_accept(apr_socket_t **new, apr_socket_t *sock, *(*new)->local_addr = *sock->local_addr; - /* The above assignment just overwrote the pool entry. Setting the local_addr - pool for the accepted socket back to what it should be. Otherwise all + /* The above assignment just overwrote the pool entry. Setting the local_addr + pool for the accepted socket back to what it should be. Otherwise all allocations for this socket will come from a server pool that is not freed until the process goes down.*/ (*new)->local_addr->pool = connection_context; @@ -348,7 +348,7 @@ apr_status_t apr_socket_accept(apr_socket_t **new, apr_socket_t *sock, !memcmp(sock->local_addr->ipaddr_ptr, generic_inaddr_any, sock->local_addr->ipaddr_len)) { - /* If the interface address inside the listening socket's local_addr wasn't + /* If the interface address inside the listening socket's local_addr wasn't * up-to-date, we don't know local interface of the connected socket either. * * If the listening socket was not bound to a specific interface, we @@ -387,7 +387,7 @@ apr_status_t apr_socket_accept(apr_socket_t **new, apr_socket_t *sock, apr_status_t apr_socket_connect(apr_socket_t *sock, apr_sockaddr_t *sa) { - int rc; + int rc; do { rc = connect(sock->socketdes, @@ -409,7 +409,7 @@ apr_status_t apr_socket_connect(apr_socket_t *sock, apr_sockaddr_t *sa) { int error; apr_socklen_t len = sizeof(error); - if ((rc = getsockopt(sock->socketdes, SOL_SOCKET, SO_ERROR, + if ((rc = getsockopt(sock->socketdes, SOL_SOCKET, SO_ERROR, (char *)&error, &len)) < 0) { return errno; } @@ -509,8 +509,8 @@ apr_status_t apr_os_sock_get(apr_os_sock_t *thesock, apr_socket_t *sock) return APR_SUCCESS; } -apr_status_t apr_os_sock_make(apr_socket_t **apr_sock, - apr_os_sock_info_t *os_sock_info, +apr_status_t apr_os_sock_make(apr_socket_t **apr_sock, + apr_os_sock_info_t *os_sock_info, apr_pool_t *cont) { alloc_socket(apr_sock, cont); @@ -518,8 +518,8 @@ apr_status_t apr_os_sock_make(apr_socket_t **apr_sock, (*apr_sock)->timeout = -1; (*apr_sock)->socketdes = *os_sock_info->os_sock; if (os_sock_info->local) { - memcpy(&(*apr_sock)->local_addr->sa.sin, - os_sock_info->local, + memcpy(&(*apr_sock)->local_addr->sa.sin, + os_sock_info->local, (*apr_sock)->local_addr->salen); /* XXX IPv6 - this assumes sin_port and sin6_port at same offset */ (*apr_sock)->local_addr->port = ntohs((*apr_sock)->local_addr->sa.sin.sin_port); @@ -531,7 +531,7 @@ apr_status_t apr_os_sock_make(apr_socket_t **apr_sock, #ifndef HAVE_POLL (*apr_sock)->connected = 1; #endif - memcpy(&(*apr_sock)->remote_addr->sa.sin, + memcpy(&(*apr_sock)->remote_addr->sa.sin, os_sock_info->remote, (*apr_sock)->remote_addr->salen); /* XXX IPv6 - this assumes sin_port and sin6_port at same offset */ @@ -540,14 +540,14 @@ apr_status_t apr_os_sock_make(apr_socket_t **apr_sock, else { (*apr_sock)->remote_addr_unknown = 1; } - + (*apr_sock)->inherit = 0; - apr_pool_cleanup_register((*apr_sock)->pool, (void *)(*apr_sock), + apr_pool_cleanup_register((*apr_sock)->pool, (void *)(*apr_sock), socket_cleanup, socket_cleanup); return APR_SUCCESS; } -apr_status_t apr_os_sock_put(apr_socket_t **sock, apr_os_sock_t *thesock, +apr_status_t apr_os_sock_put(apr_socket_t **sock, apr_os_sock_t *thesock, apr_pool_t *cont) { /* XXX Bogus assumption that *sock points at anything legit */ diff --git a/network_io/unix/sockopt.c b/network_io/unix/sockopt.c index c48ab06a5..8579f5d7d 100644 --- a/network_io/unix/sockopt.c +++ b/network_io/unix/sockopt.c @@ -90,14 +90,14 @@ apr_status_t apr_socket_timeout_set(apr_socket_t *sock, apr_interval_time_t t) } apr_set_option(sock, APR_SO_NONBLOCK, 1); } - } + } else if (t < 0 && sock->timeout >= 0) { - if (apr_is_option_set(sock, APR_SO_NONBLOCK) != 0) { - if ((stat = soblock(sock->socketdes)) != APR_SUCCESS) { - return stat; + if (apr_is_option_set(sock, APR_SO_NONBLOCK) != 0) { + if ((stat = soblock(sock->socketdes)) != APR_SUCCESS) { + return stat; } apr_set_option(sock, APR_SO_NONBLOCK, 0); - } + } } /* must disable the incomplete read support if we disable * a timeout @@ -110,7 +110,7 @@ apr_status_t apr_socket_timeout_set(apr_socket_t *sock, apr_interval_time_t t) } -apr_status_t apr_socket_opt_set(apr_socket_t *sock, +apr_status_t apr_socket_opt_set(apr_socket_t *sock, apr_int32_t opt, apr_int32_t on) { int one; @@ -182,7 +182,7 @@ apr_status_t apr_socket_opt_set(apr_socket_t *sock, case APR_SO_NONBLOCK: if (apr_is_option_set(sock, APR_SO_NONBLOCK) != on) { if (on) { - if ((rv = sononblock(sock->socketdes)) != APR_SUCCESS) + if ((rv = sononblock(sock->socketdes)) != APR_SUCCESS) return rv; } else { @@ -213,7 +213,7 @@ apr_status_t apr_socket_opt_set(apr_socket_t *sock, int optlevel = IPPROTO_TCP; int optname = TCP_DEFER_ACCEPT; - if (setsockopt(sock->socketdes, optlevel, optname, + if (setsockopt(sock->socketdes, optlevel, optname, (void *)&on, sizeof(int)) == -1) { return errno; } @@ -348,8 +348,8 @@ apr_status_t apr_socket_opt_set(apr_socket_t *sock, return APR_EINVAL; } - return APR_SUCCESS; -} + return APR_SUCCESS; +} apr_status_t apr_socket_timeout_get(apr_socket_t *sock, apr_interval_time_t *t) @@ -359,7 +359,7 @@ apr_status_t apr_socket_timeout_get(apr_socket_t *sock, apr_interval_time_t *t) } -apr_status_t apr_socket_opt_get(apr_socket_t *sock, +apr_status_t apr_socket_opt_get(apr_socket_t *sock, apr_int32_t opt, apr_int32_t *on) { switch(opt) { @@ -392,7 +392,7 @@ apr_status_t apr_gethostname(char *buf, apr_int32_t len, apr_pool_t *cont) if (gethostname(buf, len) == 0) { #else if (gethostname(buf, len) != 0) { -#endif +#endif buf[0] = '\0'; return errno; } -- cgit v1.2.1