daemon: Allow compilation with GCC 4.9.

Reported by Ricardo Wurmus.

* nix/nix-daemon/nix-daemon.cc (acceptConnection): Remove intermediate
'inaddr' variables that relied on implicit casts.  This fixes
compilation with GCC 4.9.
This commit is contained in:
Ludovic Courtès 2017-07-10 11:54:25 +02:00 committed by Ludovic Courtès
parent eb737a271a
commit 5c82722cac
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 2 additions and 4 deletions

View File

@ -887,13 +887,11 @@ static void acceptConnection(int fdSocket)
if (remoteAddr.ss_family == AF_INET) {
struct sockaddr_in *addr = (struct sockaddr_in *) &remoteAddr;
struct in_addr inaddr = { addr->sin_addr };
result = inet_ntop(AF_INET, &inaddr,
result = inet_ntop(AF_INET, &addr->sin_addr,
address_str, sizeof address_str);
} else if (remoteAddr.ss_family == AF_INET6) {
struct sockaddr_in6 *addr = (struct sockaddr_in6 *) &remoteAddr;
struct in6_addr inaddr = { addr->sin6_addr };
result = inet_ntop(AF_INET6, &inaddr,
result = inet_ntop(AF_INET6, &addr->sin6_addr,
address_str, sizeof address_str);
} else {
result = NULL;