summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2015-02-02 14:46:40 -0500
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2015-02-02 20:31:18 -0500
commitfe0885f8ce0f49c8d7496344c39abbebc46c6155 (patch)
tree159d46b8e3ac96bde1257be71be4f3ae91bd2a36 /src
parente0ec8950935ce587935e299c22232fbf4a2664c9 (diff)
test-dhcp-client: open a real udp socket for test execution
./test-dhcp-client would attempt to operate fd 0, i.e. stdin. For example, './test-dhcp-client </dev/null' would fail with EPERM because /dev/null cannot be used with epoll. https://bugzilla.redhat.com/show_bug.cgi?id=1076119
Diffstat (limited to 'src')
-rw-r--r--src/libsystemd-network/test-dhcp-client.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/libsystemd-network/test-dhcp-client.c b/src/libsystemd-network/test-dhcp-client.c
index 8e2ede9bf6..831ec19059 100644
--- a/src/libsystemd-network/test-dhcp-client.c
+++ b/src/libsystemd-network/test-dhcp-client.c
@@ -218,7 +218,13 @@ int dhcp_network_bind_raw_socket(int index, union sockaddr_union *link,
int dhcp_network_bind_udp_socket(be32_t address, uint16_t port)
{
- return 0;
+ int fd;
+
+ fd = socket(AF_INET, SOCK_DGRAM|SOCK_CLOEXEC, 0);
+ if (fd < 0)
+ return -errno;
+
+ return fd;
}
int dhcp_network_send_udp_socket(int s, be32_t address, uint16_t port,