chiark / gitweb /
sd-dhcp-client: test - don't close socket twice
authorTom Gundersen <teg@jklm.no>
Sat, 22 Mar 2014 09:52:49 +0000 (10:52 +0100)
committerTom Gundersen <teg@jklm.no>
Sat, 22 Mar 2014 09:52:49 +0000 (10:52 +0100)
One end of the socketpair is closed by the library, so only close our end. Also switch to
the safe_close() so we get notified about problems with closing.

src/libsystemd-network/test-dhcp-client.c

index ca44cfbdc52b0269665b97226117dfdc7b5cf265..0f7adac562978c099a95a1f83c825b0e30070620 100644 (file)
@@ -253,8 +253,7 @@ static void test_discover_message(sd_event *e)
         sd_dhcp_client_stop(client);
         sd_dhcp_client_free(client);
 
-        close(test_fd[0]);
-        close(test_fd[1]);
+        test_fd[1] = safe_close(test_fd[1]);
 
         callback_recv = NULL;
 }
@@ -482,8 +481,7 @@ static void test_addr_acq(sd_event *e)
         sd_dhcp_client_stop(client);
         sd_dhcp_client_free(client);
 
-        close(test_fd[0]);
-        close(test_fd[1]);
+        test_fd[1] = safe_close(test_fd[1]);
 
         callback_recv = NULL;
         xid = 0;