#include <string.h>
#include <unistd.h>
#include <kernel-features.h>
+#include <libc-internal.h>
#if PACKETSZ > 65536
#define MAXPACKET PACKETSZ
// int anssiz = *anssizp;
HEADER *anhp = (HEADER *) ans;
struct sockaddr_in6 *nsap = EXT(statp).nsaddrs[ns];
- int truncating, connreset, resplen, n;
+ int truncating, connreset, n;
+ /* On some architectures compiler might emit a warning indicating
+ 'resplen' may be used uninitialized. However if buf2 == NULL
+ then this code won't be executed; if buf2 != NULL, then first
+ time round the loop recvresp1 and recvresp2 will be 0 so this
+ code won't be executed but "thisresplenp = &resplen;" followed
+ by "*thisresplenp = rlen;" will be executed so that subsequent
+ times round the loop resplen has been initialized. So this is
+ a false-positive.
+ */
+#if __GNUC_PREREQ (4, 7)
+ DIAG_PUSH_NEEDS_COMMENT;
+ DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+#endif
+ int resplen;
+#if __GNUC_PREREQ (4, 7)
+ DIAG_POP_NEEDS_COMMENT;
+#endif
struct iovec iov[4];
u_short len;
u_short len2;
/* No buffer allocated for the first
reply. We can try to use the rest
of the user-provided buffer. */
+#if __GNUC_PREREQ (4, 7)
+ DIAG_PUSH_NEEDS_COMMENT;
+ DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+#endif
#if _STRING_ARCH_unaligned
*anssizp2 = orig_anssizp - resplen;
*ansp2 = *ansp + resplen;
& ~(__alignof__ (HEADER) - 1));
*anssizp2 = orig_anssizp - aligned_resplen;
*ansp2 = *ansp + aligned_resplen;
+#endif
+#if __GNUC_PREREQ (4, 7)
+ DIAG_POP_NEEDS_COMMENT;
#endif
} else {
/* The first reply did not fit into the