kdbus: don't clobber return values, use strjoin() instead of asprintf(), keep functio...
authorLennart Poettering <lennart@poettering.net>
Thu, 2 Oct 2014 18:37:36 +0000 (20:37 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 2 Oct 2014 18:38:00 +0000 (20:38 +0200)
src/libsystemd/sd-bus/bus-kernel.c

index 0e74f9136accc44b74d4e66e93315e7e6650346d..0c39e22ed78706dc066f85e77d5f6ef732e0eb88 100644 (file)
@@ -1447,11 +1447,15 @@ int bus_kernel_create_endpoint(const char *bus_name, const char *ep_name, char *
         }
 
         if (ep_path) {
-                int r = asprintf(ep_path, "%s/%s", dirname(path), ep_name);
-                if (r == -1 || !*ep_path) {
+                char *p;
+
+                p = strjoin(dirname(path), "/", ep_name, NULL);
+                if (!p) {
                         safe_close(fd);
                         return -ENOMEM;
                 }
+
+                *ep_path = p;
         }
 
         return fd;