]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/libsystemd/sd-bus/bus-control.c
tree-wide: sort includes
[thirdparty/systemd.git] / src / libsystemd / sd-bus / bus-control.c
index ad83446254cb37af63bafd299cf3c0e7365efe56..94251fe87c018bf2313d766c2878aa1c1709d952 100644 (file)
 #include <valgrind/memcheck.h>
 #endif
 
-#include <stddef.h>
 #include <errno.h>
+#include <stddef.h>
 
-#include "strv.h"
 #include "sd-bus.h"
+
+#include "alloc-util.h"
+#include "bus-bloom.h"
+#include "bus-control.h"
 #include "bus-internal.h"
 #include "bus-message.h"
-#include "bus-control.h"
-#include "bus-bloom.h"
-#include "capability.h"
+#include "bus-util.h"
+#include "capability-util.h"
+#include "stdio-util.h"
+#include "string-util.h"
+#include "strv.h"
+#include "user-util.h"
 
 _public_ int sd_bus_get_unique_name(sd_bus *bus, const char **unique) {
         int r;
@@ -975,8 +981,12 @@ static int bus_get_owner_creds_kdbus(sd_bus *bus, uint64_t mask, sd_bus_creds **
 static int bus_get_owner_creds_dbus1(sd_bus *bus, uint64_t mask, sd_bus_creds **ret) {
         _cleanup_bus_creds_unref_ sd_bus_creds *c = NULL;
         pid_t pid = 0;
+        bool do_label;
         int r;
-        bool do_label = bus->label && (mask & SD_BUS_CREDS_SELINUX_CONTEXT);
+
+        assert(bus);
+
+        do_label = bus->label && (mask & SD_BUS_CREDS_SELINUX_CONTEXT);
 
         /* Avoid allocating anything if we have no chance of returning useful data */
         if (!bus->ucred_valid && !do_label)
@@ -1309,9 +1319,9 @@ int bus_add_match_internal_kernel(
                 }
 
                 case BUS_MATCH_ARG_HAS...BUS_MATCH_ARG_HAS_LAST: {
-                        char buf[sizeof("arg")-1 + 2 + sizeof("has")];
+                        char buf[sizeof("arg")-1 + 2 + sizeof("-has")];
 
-                        xsprintf(buf, "arg%ihas", c->type - BUS_MATCH_ARG_HAS);
+                        xsprintf(buf, "arg%i-has", c->type - BUS_MATCH_ARG_HAS);
                         bloom_add_pair(bloom, bus->bloom_size, bus->bloom_n_hash, buf, c->value_str);
                         using_bloom = true;
                         break;