X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Flibsystemd-bus%2Fsd-bus.c;h=7f3ecbf8047eb3d815b8646ae7ccb66e608aee5b;hb=843f737ade9c73609a2280dd3dd16e18222a5dcb;hp=43be1debdcf7c4a317aa6cc0a451fdfcb3c0f20b;hpb=758bf0c755e045f7b1dd89869d3a10b9457e9bbe;p=elogind.git diff --git a/src/libsystemd-bus/sd-bus.c b/src/libsystemd-bus/sd-bus.c index 43be1debd..7f3ecbf80 100644 --- a/src/libsystemd-bus/sd-bus.c +++ b/src/libsystemd-bus/sd-bus.c @@ -34,6 +34,7 @@ #include "strv.h" #include "set.h" #include "missing.h" +#include "def.h" #include "sd-bus.h" #include "bus-internal.h" @@ -1047,12 +1048,7 @@ _public_ int sd_bus_open_system(sd_bus **ret) { if (e) r = sd_bus_set_address(b, e); else -#ifdef ENABLE_KDBUS - r = sd_bus_set_address(b, "kernel:path=/dev/kdbus/0-system/bus;unix:path=/run/dbus/system_bus_socket"); -#else - r = sd_bus_set_address(b, "unix:path=/run/dbus/system_bus_socket"); -#endif - + r = sd_bus_set_address(b, DEFAULT_SYSTEM_BUS_PATH); if (r < 0) goto fail; @@ -1103,13 +1099,13 @@ _public_ int sd_bus_open_user(sd_bus **ret) { } #ifdef ENABLE_KDBUS - asprintf(&b->address, "kernel:path=/dev/kdbus/%lu-user/bus;unix:path=%s/bus", (unsigned long) getuid(), ee); + asprintf(&b->address, KERNEL_USER_BUS_FMT ";" UNIX_USER_BUS_FMT, (unsigned long) getuid(), ee); #else - b->address = strjoin("unix:path=", ee, "/bus", NULL); + asprintf(&b->address, UNIX_USER_BUS_FMT, ee); #endif } else { #ifdef ENABLE_KDBUS - asprintf(&b->address, "kernel:path=/dev/kdbus/%lu-user/bus", (unsigned long) getuid()); + asprintf(&b->address, KERNEL_USER_BUS_FMT, (unsigned long) getuid()); #else return -ECONNREFUSED; #endif @@ -1238,7 +1234,7 @@ _public_ void sd_bus_close(sd_bus *bus) { /* We'll leave the fd open in case this is a kernel bus, since * there might still be memblocks around that reference this - * bus, and they might need to invoke the * KDBUS_CMD_FREE + * bus, and they might need to invoke the KDBUS_CMD_FREE * ioctl on the fd when they are freed. */ } @@ -1376,7 +1372,7 @@ static int bus_write_message(sd_bus *bus, sd_bus_message *m, size_t *idx) { if (r <= 0) return r; - if (bus->is_kernel || bus->windex >= BUS_MESSAGE_SIZE(m)) + if (bus->is_kernel || *idx >= BUS_MESSAGE_SIZE(m)) log_debug("Sent message type=%s sender=%s destination=%s object=%s interface=%s member=%s cookie=%lu reply_cookie=%lu error=%s", bus_message_type_to_string(m->header->type), strna(sd_bus_message_get_sender(m)),