bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug in getaddrinfo module


From: Eric Blake
Subject: bug in getaddrinfo module
Date: Tue, 08 Nov 2005 16:59:42 +0000

coreutils-5.93 and "CFLAGS='-Wall' ./gnulib-tool --test canon-host"
currently evoke the following warnings on cygwin when using
CVS autoconf:

gcc -DHAVE_CONFIG_H -I. -I../../lib -I..     -Wall -c ../../lib/canon-host.c
../../lib/canon-host.c: In function `canon_host_r':
../../lib/canon-host.c:71: warning: implicit declaration of function 
`getaddrinfo'
../../lib/canon-host.c:77: warning: implicit declaration of function 
`freeaddrinfo'
../../lib/canon-host.c: In function `ch_strerror':
../../lib/canon-host.c:89: warning: implicit declaration of function 
`gai_strerror'
../../lib/canon-host.c:89: warning: return makes pointer from integer without a 
cast

Cygwin provides sys/socket.h and netdb.h, but has not yet
provided an implementation for getaddrinfo, freeaddrinfo,
or gai_strerror.  It looks like getaddrinfo.h is using
#ifndef HAVE_DECL_GETADDRINFO, but AC_CHECK_DECLS
uses #define HAVE_DECL_GETADDRINFO 0 in config.h.

Fortunately, the implicit definition of these functions works on
cygwin (all arguments are int or pointer, and cygwin uses 32-bit
pointers), but it is a bug waiting to happen on a 64-bit platform.

Fixed thusly:

2005-11-08  Eric Blake  <address@hidden>

        * getaddrinfo.h: Use #if !, not #ifndef, for AC_CHECK_DECLS.

Index: lib/getaddrinfo.h
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/getaddrinfo.h,v
retrieving revision 1.10
diff -u -r1.10 getaddrinfo.h
--- lib/getaddrinfo.h   5 Oct 2005 08:46:24 -0000       1.10
+++ lib/getaddrinfo.h   8 Nov 2005 16:58:15 -0000
@@ -82,7 +82,7 @@
 #  endif
 # endif
 
-# ifndef HAVE_DECL_GETADDRINFO
+# if !HAVE_DECL_GETADDRINFO
 /* Translate name of a service location and/or a service name to set of
    socket addresses.
    For more details, see the POSIX:2001 specification
@@ -93,14 +93,14 @@
                        struct addrinfo **restrict res);
 # endif
 
-# ifndef HAVE_DECL_FREEADDRINFO
+# if !HAVE_DECL_FREEADDRINFO
 /* Free `addrinfo' structure AI including associated storage.
    For more details, see the POSIX:2001 specification
    <http://www.opengroup.org/susv3xsh/getaddrinfo.html>.  */
 extern void freeaddrinfo (struct addrinfo *ai);
 # endif
 
-# ifndef HAVE_DECL_GAI_STRERROR
+# if !HAVE_DECL_GAI_STRERROR
 /* Convert error return from getaddrinfo() to a string.
    For more details, see the POSIX:2001 specification
    <http://www.opengroup.org/susv3xsh/gai_strerror.html>.  */


--
Eric Blake




reply via email to

[Prev in Thread] Current Thread [Next in Thread]