]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-bus: use strextend()
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 20 May 2021 05:24:57 +0000 (14:24 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 20 May 2021 09:18:56 +0000 (18:18 +0900)
src/libsystemd/sd-bus/sd-bus.c

index 0ec0d8d26ea1c9a1a415bdaf31888f444d0d21e4..090288af0df45163a9761195f3d109228aa6ee87 100644 (file)
@@ -1574,18 +1574,12 @@ int bus_set_address_machine(sd_bus *b, bool user, const char *machine) {
                         return -ENOMEM;
 
                 if (user) {
-                        char *k;
-
                         /* Ideally we'd use the "--user" switch to systemd-stdio-bridge here, but it's only
                          * available in recent systemd versions. Using the "-p" switch with the explicit path
                          * is a working alternative, and is compatible with older versions, hence that's what
                          * we use here. */
-
-                        k = strjoin(a, ",argv7=-punix:path%3d%24%7bXDG_RUNTIME_DIR%7d/bus");
-                        if (!k)
+                        if (!strextend(&a, ",argv7=-punix:path%3d%24%7bXDG_RUNTIME_DIR%7d/bus"))
                                 return -ENOMEM;
-
-                        free_and_replace(a, k);
                 }
         } else {
                 _cleanup_free_ char *e = NULL;