chiark / gitweb /
sd-bus: cleanup bus_close_fds()
authorNamhyung Kim <namhyung@gmail.com>
Sat, 1 Aug 2015 15:35:22 +0000 (00:35 +0900)
committerSven Eden <yamakuzure@gmx.net>
Tue, 14 Mar 2017 09:18:46 +0000 (10:18 +0100)
The safe_close() already checks the fd and returns -1.

src/libelogind/sd-bus/sd-bus.c

index eb9525ed71f13013a4a11bcd656f55d451578cf4..1d60600faeb6f8d10ec597ba38c4b2dc4a3cd376 100644 (file)
@@ -73,13 +73,9 @@ static void bus_close_fds(sd_bus *b) {
 
         detach_io_events(b);
 
-        if (b->input_fd >= 0)
-                safe_close(b->input_fd);
-
-        if (b->output_fd >= 0 && b->output_fd != b->input_fd)
+        if (b->input_fd != b->output_fd)
                 safe_close(b->output_fd);
-
-        b->input_fd = b->output_fd = -1;
+        b->output_fd = b->input_fd = safe_close(b->input_fd);
 }
 
 static void bus_reset_queues(sd_bus *b) {