bug-gnulib
[Top][All Lists]
Advanced

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

Re: EAI_NODATA used in test-getaddrinfo.c


From: Jim Meyering
Subject: Re: EAI_NODATA used in test-getaddrinfo.c
Date: Tue, 03 Nov 2009 08:54:10 +0100

Simon Josefsson wrote:

> Bruno Haible <address@hidden> writes:
>
>> Jim Meyering wrote:
>>> On Freebsd8-rc2 I saw this:
>>>
>>>   test-getaddrinfo.c: In function 'simple':
>>>   test-getaddrinfo.c:95: error: 'EAI_NODATA' undeclared (first use in this 
>>> function)
>>>
>>> lib/netdb.h was not generated.
>>>
>>> Here's one way to fix it, but
>>> I haven't dug enough yet to know if that's appropriate:
>>>
>>> diff --git a/tests/test-getaddrinfo.c b/tests/test-getaddrinfo.c
>>> index 384b98b..57c1a4d 100644
>>> --- a/tests/test-getaddrinfo.c
>>> +++ b/tests/test-getaddrinfo.c
>>> @@ -91,10 +91,12 @@ simple (char const *host, char const *service)
>>>      fail the test merely because of this.  */
>>>        if (res == EAI_SERVICE)
>>>     return 0;
>>> +#ifdef EAI_NODATA
>>>        /* AIX reports EAI_NODATA for "https".  Don't fail the test
>>>      merely because of this.  */
>>>        if (res == EAI_NODATA)
>>>     return 0;
>>> +#endif
>>>        /* Provide details if errno was set.  */
>>>        if (res == EAI_SYSTEM)
>>>     dbgprintf ("system error: %s\n", strerror (err));
>>
>> Yes, it's the best way to fix this. EAI_NODATA is not mandated by POSIX,
>> therefore it is OK if gnulib does not override <netdb.h> on this platform.
>> Hence it's the test which has to be corrected.
>
> Fine with me, please push it.  Thanks, Jim.

Pushed.
FYI, it was FreeBSD 7.2, not Freebsd8-rc2:

>From 70c49dd70b22a27ad27e89ee6159aa2daba396f0 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Tue, 3 Nov 2009 08:53:23 +0100
Subject: [PATCH] test-getaddrinfo: avoid compilation failure on FreeBSD 7.2

* tests/test-getaddrinfo.c (simple): Test for EAI_NODATA only
if it is defined.
---
 ChangeLog                |    6 ++++++
 tests/test-getaddrinfo.c |    2 ++
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 3dfebc5..239ec70 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-11-03  Jim Meyering  <address@hidden>
+
+       test-getaddrinfo: avoid compilation failure on FreeBSD 7.2
+       * tests/test-getaddrinfo.c (simple): Test for EAI_NODATA only
+       if it is defined.
+
 2009-11-02  Eric Blake  <address@hidden>

        mktime, timegm: share common declaration
diff --git a/tests/test-getaddrinfo.c b/tests/test-getaddrinfo.c
index 384b98b..57c1a4d 100644
--- a/tests/test-getaddrinfo.c
+++ b/tests/test-getaddrinfo.c
@@ -91,10 +91,12 @@ simple (char const *host, char const *service)
         fail the test merely because of this.  */
       if (res == EAI_SERVICE)
        return 0;
+#ifdef EAI_NODATA
       /* AIX reports EAI_NODATA for "https".  Don't fail the test
         merely because of this.  */
       if (res == EAI_NODATA)
        return 0;
+#endif
       /* Provide details if errno was set.  */
       if (res == EAI_SYSTEM)
        dbgprintf ("system error: %s\n", strerror (err));
--
1.6.5.2.292.g1cda2




reply via email to

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