chiark / gitweb /
sd-bus: introduce new sd_bus_flush_close_unref() call
[elogind.git] / src / libelogind / sd-bus / sd-bus.c
index c576350766fc8629d2dacffd4feb7303aaced3da..87263b74f24ae290246a0c0e7b997f46ba435838 100644 (file)
@@ -1425,6 +1425,17 @@ _public_ void sd_bus_close(sd_bus *bus) {
          * ioctl on the fd when they are freed. */
 }
 
+_public_ sd_bus* sd_bus_flush_close_unref(sd_bus *bus) {
+
+        if (!bus)
+                return NULL;
+
+        sd_bus_flush(bus);
+        sd_bus_close(bus);
+
+        return sd_bus_unref(bus);
+}
+
 static void bus_enter_closing(sd_bus *bus) {
         assert(bus);