]> granicus.if.org Git - libevent/commitdiff
test: adjust expecting error for getaddrinfo() under EMFILE
authorAzat Khuzhin <azat@libevent.org>
Sat, 26 Jan 2019 15:52:33 +0000 (18:52 +0300)
committerAzat Khuzhin <azat@libevent.org>
Sat, 26 Jan 2019 16:57:37 +0000 (19:57 +0300)
When getaddrinfo() cannot allocate file descriptor glibc/musl-libc on
linux report EAI_SYSTEM error. But this is not true for freebsd libc [1]
(and hence apple libc [2]), they report EAI_NONAME error instead, so
adjust expectation.

  [1]: https://github.com/freebsd/freebsd/blob/master/lib/libc/net/getaddrinfo.c
  [2]: https://opensource.apple.com/source/Libc/

Refs: #749
Refs: https://github.com/libevent/libevent/issues/749#issuecomment-457838159

test/regress_dns.c

index 9a3f88dc3b1c779c45eb3084756601c36967ce0c..75988a95592229a015529bffeb731bd8c4644d74 100644 (file)
@@ -1218,7 +1218,14 @@ test_bufferevent_connect_hostname(void *arg)
 
        if (emfile) {
                success = BEV_EVENT_ERROR;
+#ifdef __linux__
+               /* on linux glibc/musl reports EAI_SYSTEM, when getaddrinfo() cannot
+                * open file for resolving service. */
                default_error = EVUTIL_EAI_SYSTEM;
+#else
+               /* on osx/freebsd it returns EAI_NONAME */
+               default_error = EVUTIL_EAI_NONAME;
+#endif
        }
 
        be_connect_hostname_base = data->base;