free(b->machine);
free(b->fake_label);
free(b->cgroup_root);
+ free(b->connection_name);
free(b->exec_path);
strv_free(b->exec_argv);
return 0;
}
+_public_ int sd_bus_set_name(sd_bus *bus, const char *name) {
+ char *n;
+
+ assert_return(bus, -EINVAL);
+ assert_return(name, -EINVAL);
+ assert_return(bus->state == BUS_UNSET, -EPERM);
+ assert_return(!bus_pid_changed(bus), -ECHILD);
+
+ n = strdup(name);
+ if (!n)
+ return -ENOMEM;
+
+ free(bus->connection_name);
+ bus->connection_name = n;
+
+ return 0;
+}
+
static int hello_callback(sd_bus *bus, sd_bus_message *reply, void *userdata, sd_bus_error *error) {
const char *s;
int r;
goto fail;
b->bus_client = true;
+ b->is_system = true;
/* Let's do per-method access control on the system bus. We
* need the caller's UID and capability set for that. */
}
b->bus_client = true;
+ b->is_user = true;
/* We don't do any per-method access control on the user
* bus. */
sd_bus_close(bus);
return 0;
}
+
+_public_ int sd_bus_get_name(sd_bus *bus, const char **name) {
+ assert_return(bus, -EINVAL);
+ assert_return(name, -EINVAL);
+ assert_return(!bus_pid_changed(bus), -ECHILD);
+
+ *name = bus->connection_name;
+ return 0;
+}