From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20640 invoked by alias); 19 Aug 2004 10:32:56 -0000 Mailing-List: contact libc-hacker-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-hacker-owner@sources.redhat.com Received: (qmail 20604 invoked from network); 19 Aug 2004 10:32:53 -0000 Received: from unknown (HELO sunsite.ms.mff.cuni.cz) (195.113.15.26) by sourceware.org with SMTP; 19 Aug 2004 10:32:53 -0000 Received: from sunsite.ms.mff.cuni.cz (sunsite.mff.cuni.cz [127.0.0.1]) by sunsite.ms.mff.cuni.cz (8.12.8/8.12.8) with ESMTP id i7J8FZ3j019221; Thu, 19 Aug 2004 10:15:35 +0200 Received: (from jakub@localhost) by sunsite.ms.mff.cuni.cz (8.12.8/8.12.8/Submit) id i7J8FZuV019219; Thu, 19 Aug 2004 10:15:35 +0200 Date: Thu, 19 Aug 2004 10:32:00 -0000 From: Jakub Jelinek To: Ulrich Drepper Cc: Glibc hackers Subject: [PATCH] Warning fixes Message-ID: <20040819081535.GU30497@sunsite.ms.mff.cuni.cz> Reply-To: Jakub Jelinek Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.1i X-SW-Source: 2004-08/txt/msg00060.txt.bz2 Hi! ../sysdeps/posix/getaddrinfo.c: In function `gaih_inet': ../sysdeps/posix/getaddrinfo.c:859: warning: assignment discards qualifiers from pointer target type nss_dns/dns-canon.c: In function `_nss_dns_getcanonname_r': nss_dns/dns-canon.c:55: warning: 'status' might be used uninitialized in this function The former is because ai_canonname is char *, while canon is const char *. No idea if char * ai_canonname is in the standard just for historical reasons or if it actually ought to be writable. The latter sounds like a bug, if both A and AAAA queries fail, _nss_dns_getcanonname_r would return the unitialized status value, so with bad luck it could be NSS_STATUS_SUCCESS which is the only value the caller cares about. 2004-08-19 Jakub Jelinek * sysdeps/posix/getaddrinfo.c (gaih_inet): Cast canon to (char *) to avoid warning. * resolv/nss_dns/dns-canon.c (_nss_dns_getcanonname_r): Initialize status to NSS_STATUS_UNAVAIL. --- libc/sysdeps/posix/getaddrinfo.c.jj 2004-08-19 12:18:26.000000000 +0200 +++ libc/sysdeps/posix/getaddrinfo.c 2004-08-19 12:22:23.251899931 +0200 @@ -856,7 +856,7 @@ gaih_inet (const char *name, const struc (*pai)->ai_addr = (void *) (*pai + 1); /* We only add the canonical name once. */ - (*pai)->ai_canonname = canon; + (*pai)->ai_canonname = (char *) canon; canon = NULL; #if SALEN --- libc/resolv/nss_dns/dns-canon.c.jj 2004-08-16 19:13:13.000000000 +0200 +++ libc/resolv/nss_dns/dns-canon.c 2004-08-19 12:24:36.573339586 +0200 @@ -52,7 +52,7 @@ _nss_dns_getcanonname_r (const char *nam querybuf *buf; unsigned char *ptr; } ansp = { .ptr = buf }; - enum nss_status status; + enum nss_status status = NSS_STATUS_UNAVAIL; int qtypes[] = { ns_t_a, ns_t_aaaa }; #define nqtypes (sizeof (qtypes) / sizeof (qtypes[0])) Jakub