]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/libsystemd/sd-bus/test-bus-chat.c
Add SPDX license identifiers to source files under the LGPL
[thirdparty/systemd.git] / src / libsystemd / sd-bus / test-bus-chat.c
index f20eced4ac438261211fb4a4ca38eae2cce53dbe..1b2efb9bb4e93ef6682cb097fe75d2eabb2168c5 100644 (file)
@@ -1,5 +1,4 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
+/* SPDX-License-Identifier: LGPL-2.1+ */
 /***
   This file is part of systemd.
 
@@ -32,7 +31,7 @@
 #include "bus-match.h"
 #include "bus-util.h"
 #include "fd-util.h"
-#include "formats-util.h"
+#include "format-util.h"
 #include "log.h"
 #include "macro.h"
 #include "util.h"
@@ -130,7 +129,7 @@ static int server(sd_bus *bus) {
         bool client1_gone = false, client2_gone = false;
 
         while (!client1_gone || !client2_gone) {
-                _cleanup_bus_message_unref_ sd_bus_message *m = NULL;
+                _cleanup_(sd_bus_message_unrefp) sd_bus_message *m = NULL;
                 pid_t pid = 0;
                 const char *label = NULL;
 
@@ -261,9 +260,9 @@ fail:
 }
 
 static void* client1(void*p) {
-        _cleanup_bus_message_unref_ sd_bus_message *reply = NULL;
-        _cleanup_bus_flush_close_unref_ sd_bus *bus = NULL;
-        _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
+        _cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL;
+        _cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
+        _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
         const char *hello;
         int r;
         _cleanup_close_pair_ int pp[2] = { -1, -1 };
@@ -331,7 +330,7 @@ static void* client1(void*p) {
 
 finish:
         if (bus) {
-                _cleanup_bus_message_unref_ sd_bus_message *q;
+                _cleanup_(sd_bus_message_unrefp) sd_bus_message *q;
 
                 r = sd_bus_message_new_method_call(
                                 bus,
@@ -353,16 +352,16 @@ finish:
 static int quit_callback(sd_bus_message *m, void *userdata, sd_bus_error *ret_error) {
         bool *x = userdata;
 
-        log_error("Quit callback: %s", strerror(sd_bus_message_get_errno(m)));
+        log_error_errno(sd_bus_message_get_errno(m), "Quit callback: %m");
 
         *x = 1;
         return 1;
 }
 
 static void* client2(void*p) {
-        _cleanup_bus_message_unref_ sd_bus_message *m = NULL, *reply = NULL;
-        _cleanup_bus_flush_close_unref_ sd_bus *bus = NULL;
-        _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
+        _cleanup_(sd_bus_message_unrefp) sd_bus_message *m = NULL, *reply = NULL;
+        _cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
+        _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
         bool quit = false;
         const char *mid;
         int r;
@@ -499,7 +498,7 @@ static void* client2(void*p) {
 
 finish:
         if (bus) {
-                _cleanup_bus_message_unref_ sd_bus_message *q;
+                _cleanup_(sd_bus_message_unrefp) sd_bus_message *q;
 
                 r = sd_bus_message_new_method_call(
                                 bus,