inet_ntop: silence gcc warning
authorEric Blake <eblake@redhat.com>
Wed, 11 Jan 2012 21:48:31 +0000 (14:48 -0700)
committerEric Blake <eblake@redhat.com>
Wed, 11 Jan 2012 21:48:31 +0000 (14:48 -0700)
gcc -O2 couldn't tell that if best.base != -1, then best.len
was necessarily initialized.

* lib/inet_ntop.c (inet_ntop6): Initialize best.base.
Reported by Daniel P. Berrange.

Signed-off-by: Eric Blake <eblake@redhat.com>
ChangeLog
lib/inet_ntop.c

index 9d5f746..3399dda 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2012-01-11  Eric Blake  <eblake@redhat.com>
+
+       inet_ntop: silence gcc warning
+       * lib/inet_ntop.c (inet_ntop6): Initialize best.base.
+       Reported by Daniel P. Berrange.
+
 2012-01-11  Dmitry V. Levin  <ldv@altlinux.org>
 
        getloadavg test: skip the test on GNU/Linux without /proc mounted
index a487019..d7e6b23 100644 (file)
@@ -166,6 +166,7 @@ inet_ntop6 (const unsigned char *src, char *dst, socklen_t size)
   for (i = 0; i < NS_IN6ADDRSZ; i += 2)
     words[i / 2] = (src[i] << 8) | src[i + 1];
   best.base = -1;
+  best.len = 0;
   cur.base = -1;
   for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++)
     {