Skip to content
Permalink
Browse files

Fix compiler warning

Found by: michaelortmann
Patch by: michaelortmann
  • Loading branch information...
michaelortmann authored and vanosg committed Oct 6, 2019
1 parent 645884d commit 79c05537b3565d09dd433c034df13b8c8fd166a1
Showing with 9 additions and 8 deletions.
  1. +3 −3 src/dns.c
  2. +6 −5 src/net.c
@@ -464,8 +464,8 @@ void call_ipbyhost(char *hostn, sockname_t *ip, int ok)
*/
void block_dns_hostbyip(sockname_t *addr)
{
static char host[UHOSTLEN];
int i = 1;
char host[UHOSTLEN];
volatile int i = 1;

if (addr->family == AF_INET) {
if (!sigsetjmp(alarmret, 1)) {
@@ -477,7 +477,7 @@ void block_dns_hostbyip(sockname_t *addr)
debug1("dns: getnameinfo(): error = %s", gai_strerror(i));
}
if (i)
inet_ntop(AF_INET, &addr->addr.s4.sin_addr.s_addr, host, sizeof host);
inet_ntop(AF_INET, &addr->addr.s4.sin_addr.s_addr, host, sizeof host);
#ifdef IPV6
} else {
if (!sigsetjmp(alarmret, 1)) {
@@ -130,6 +130,7 @@ char *iptostr(struct sockaddr *sa)
*/
int setsockname(sockname_t *addr, char *src, int port, int allowres)
{
char *src2 = src;
char *endptr;
long val;
IP ip;
@@ -150,24 +151,24 @@ int setsockname(sockname_t *addr, char *src, int port, int allowres)
ip = htonl(val);
if (inet_ntop(AF_INET, &ip, ip2, sizeof ip2)) {
debug2("net: setsockname(): ip %s -> %s", src, ip2);
src = ip2;
src2 = ip2;
}
}
#ifdef IPV6
/* Clean start */
egg_bzero(addr, sizeof(sockname_t));
pref = pref_af ? AF_INET6 : AF_INET;
if (pref == AF_INET) {
if (inet_pton(AF_INET, src, &addr->addr.s4.sin_addr) == 1)
if (inet_pton(AF_INET, src2, &addr->addr.s4.sin_addr) == 1)
af = AF_INET;
else if (inet_pton(AF_INET6, src, &addr->addr.s6.sin6_addr) == 1)
else if (inet_pton(AF_INET6, src2, &addr->addr.s6.sin6_addr) == 1)
af = AF_INET6;
else
af = AF_UNSPEC;
} else {
if (inet_pton(AF_INET6, src, &addr->addr.s6.sin6_addr) == 1)
if (inet_pton(AF_INET6, src2, &addr->addr.s6.sin6_addr) == 1)
af = AF_INET6;
else if (inet_pton(AF_INET, src, &addr->addr.s4.sin_addr) == 1)
else if (inet_pton(AF_INET, src2, &addr->addr.s4.sin_addr) == 1)
af = AF_INET;
else
af = AF_UNSPEC;

0 comments on commit 79c0553

Please sign in to comment.
You can’t perform that action at this time.