Skip to content

Commit 27596f0

Browse files
committed
net: add dummy getaddrinfo for static build
The static build fails because getaddrinfo is not available. Provide a always failing getaddrinfo implementation. Signed-off-by: Daniel Wagner <[email protected]>
1 parent b267ee8 commit 27596f0

3 files changed

Lines changed: 19 additions & 1 deletion

File tree

src/meson.build

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ else
3131
sources += 'nvme/no-json.c'
3232
endif
3333

34+
if get_option('default_library') == 'static'
35+
sources += 'nvme/net.c'
36+
endif
37+
3438
deps = [
3539
json_c_dep,
3640
openssl_dep,

src/nvme/net.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// SPDX-License-Identifier: LGPL-2.1-or-later
2+
/*
3+
* This file is part of libnvme.
4+
*/
5+
#include <netdb.h>
6+
#include <errno.h>
7+
8+
int getaddrinfo(const char *restrict node,
9+
const char *restrict service,
10+
const struct addrinfo *restrict hints,
11+
struct addrinfo **restrict res)
12+
{
13+
return EAI_FAIL;
14+
}

test/meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ uriparser = executable(
8686

8787
test('uriparser', uriparser)
8888

89-
if conf.get('HAVE_NETDB')
89+
if conf.get('HAVE_NETDB') and get_option('default_library') != 'static'
9090
mock_ifaddrs = library(
9191
'mock-ifaddrs',
9292
['mock-ifaddrs.c', ],

0 commit comments

Comments
 (0)