[PATCH 1/4] daemon.c:handle: Remove unneeded check for null pointer.
- From
Stefan Beller <stefanbeller@googlemail.com>
- Date
- Jul 14, 2013, 21:35 UTC
- Message-ID
- <1373837749-14402-1-git-send-email-stefanbeller@googlemail.com>
addr doesn't need to be checked at that line as it it already accessed 7 lines before in the if (addr->sa_family).
Signed-off-by: Stefan Beller <stefanbeller@googlemail.com> --- daemon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/daemon.c b/daemon.c index 6aeddcb..5e48c1e 100644 --- a/daemon.c +++ b/daemon.c @@ -754,19 +754,19 @@ static void handle(int incoming, struct sockaddr *addr, socklen_t addrlen) } if (addr->sa_family == AF_INET) { struct sockaddr_in *sin_addr = (void *) addr; inet_ntop(addr->sa_family, &sin_addr->sin_addr, addrbuf + 12, sizeof(addrbuf) - 12); snprintf(portbuf, sizeof(portbuf), "REMOTE_PORT=%d", ntohs(sin_addr->sin_port)); #ifndef NO_IPV6 - } else if (addr && addr->sa_family == AF_INET6) { + } else if (addr->sa_family == AF_INET6) { struct sockaddr_in6 *sin6_addr = (void *) addr; char *buf = addrbuf + 12; *buf++ = '['; *buf = '\0'; /* stpcpy() is cool */ inet_ntop(AF_INET6, &sin6_addr->sin6_addr, buf, sizeof(addrbuf) - 13); strcat(buf, "]"); snprintf(portbuf, sizeof(portbuf), "REMOTE_PORT=%d",
-- 1.8.3.2.806.gdee5b9b