chiark / gitweb /
test-dhcp-client: add a kludge to make valgrind happy
[elogind.git] / src / libsystemd-network / test-dhcp-client.c
index 8e2ede9bf61e2a7fb211ca64d62272f5f4f6d084..8e88641430389404e8a647196a1c9db9cf12a2ea 100644 (file)
@@ -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,
@@ -515,5 +521,12 @@ int main(int argc, char *argv[]) {
         test_discover_message(e);
         test_addr_acq(e);
 
+#ifdef VALGRIND
+        /* Make sure the async_close thread has finished.
+         * valgrind would report some of the phread_* structures
+         * as not cleaned up properly. */
+        sleep(1);
+#endif
+
         return 0;
 }