diff options
author | Martin Pitt <mpitt@debian.org> | 2017-03-02 10:44:39 +0100 |
---|---|---|
committer | Martin Pitt <mpitt@debian.org> | 2017-03-02 10:44:39 +0100 |
commit | 2897b343851c95927e26f45bea8c40da605dbed1 (patch) | |
tree | c15ec2f4b562d39a818acc5d65ae58944791dba9 /src/libsystemd/sd-bus | |
parent | 8a584da2774aca0b14c8aacef574e93d943d470e (diff) | |
download | systemd-2897b343851c95927e26f45bea8c40da605dbed1.tar.gz |
New upstream version 233
Diffstat (limited to 'src/libsystemd/sd-bus')
-rw-r--r-- | src/libsystemd/sd-bus/bus-common-errors.c | 3 | ||||
-rw-r--r-- | src/libsystemd/sd-bus/bus-common-errors.h | 1 | ||||
-rw-r--r-- | src/libsystemd/sd-bus/bus-control.c | 4 | ||||
-rw-r--r-- | src/libsystemd/sd-bus/bus-creds.c | 2 | ||||
-rw-r--r-- | src/libsystemd/sd-bus/bus-dump.c | 2 | ||||
-rw-r--r-- | src/libsystemd/sd-bus/bus-kernel.c | 20 | ||||
-rw-r--r-- | src/libsystemd/sd-bus/bus-socket.c | 2 | ||||
-rw-r--r-- | src/libsystemd/sd-bus/busctl-introspect.c | 88 | ||||
-rw-r--r-- | src/libsystemd/sd-bus/busctl.c | 4 | ||||
-rw-r--r-- | src/libsystemd/sd-bus/sd-bus.c | 6 | ||||
-rw-r--r-- | src/libsystemd/sd-bus/test-bus-chat.c | 2 | ||||
-rw-r--r-- | src/libsystemd/sd-bus/test-bus-creds.c | 2 | ||||
-rw-r--r-- | src/libsystemd/sd-bus/test-bus-objects.c | 2 |
13 files changed, 65 insertions, 73 deletions
diff --git a/src/libsystemd/sd-bus/bus-common-errors.c b/src/libsystemd/sd-bus/bus-common-errors.c index d2a826bf6e..b40ba2520c 100644 --- a/src/libsystemd/sd-bus/bus-common-errors.c +++ b/src/libsystemd/sd-bus/bus-common-errors.c @@ -38,7 +38,7 @@ BUS_ERROR_MAP_ELF_REGISTER const sd_bus_error_map bus_common_errors[] = { SD_BUS_ERROR_MAP(BUS_ERROR_TRANSACTION_JOBS_CONFLICTING, EDEADLK), SD_BUS_ERROR_MAP(BUS_ERROR_TRANSACTION_ORDER_IS_CYCLIC, EDEADLK), SD_BUS_ERROR_MAP(BUS_ERROR_TRANSACTION_IS_DESTRUCTIVE, EDEADLK), - SD_BUS_ERROR_MAP(BUS_ERROR_UNIT_MASKED, ESHUTDOWN), + SD_BUS_ERROR_MAP(BUS_ERROR_UNIT_MASKED, ERFKILL), SD_BUS_ERROR_MAP(BUS_ERROR_UNIT_GENERATED, EADDRNOTAVAIL), SD_BUS_ERROR_MAP(BUS_ERROR_UNIT_LINKED, ELOOP), SD_BUS_ERROR_MAP(BUS_ERROR_JOB_TYPE_NOT_APPLICABLE, EBADR), @@ -47,6 +47,7 @@ BUS_ERROR_MAP_ELF_REGISTER const sd_bus_error_map bus_common_errors[] = { SD_BUS_ERROR_MAP(BUS_ERROR_SCOPE_NOT_RUNNING, EHOSTDOWN), SD_BUS_ERROR_MAP(BUS_ERROR_NO_SUCH_DYNAMIC_USER, ESRCH), SD_BUS_ERROR_MAP(BUS_ERROR_NOT_REFERENCED, EUNATCH), + SD_BUS_ERROR_MAP(BUS_ERROR_DISK_FULL, ENOSPC), SD_BUS_ERROR_MAP(BUS_ERROR_NO_SUCH_MACHINE, ENXIO), SD_BUS_ERROR_MAP(BUS_ERROR_NO_SUCH_IMAGE, ENOENT), diff --git a/src/libsystemd/sd-bus/bus-common-errors.h b/src/libsystemd/sd-bus/bus-common-errors.h index 525b79fa77..4523be05ce 100644 --- a/src/libsystemd/sd-bus/bus-common-errors.h +++ b/src/libsystemd/sd-bus/bus-common-errors.h @@ -43,6 +43,7 @@ #define BUS_ERROR_SCOPE_NOT_RUNNING "org.freedesktop.systemd1.ScopeNotRunning" #define BUS_ERROR_NO_SUCH_DYNAMIC_USER "org.freedesktop.systemd1.NoSuchDynamicUser" #define BUS_ERROR_NOT_REFERENCED "org.freedesktop.systemd1.NotReferenced" +#define BUS_ERROR_DISK_FULL "org.freedesktop.systemd1.DiskFull" #define BUS_ERROR_NO_SUCH_MACHINE "org.freedesktop.machine1.NoSuchMachine" #define BUS_ERROR_NO_SUCH_IMAGE "org.freedesktop.machine1.NoSuchImage" diff --git a/src/libsystemd/sd-bus/bus-control.c b/src/libsystemd/sd-bus/bus-control.c index 52128e7b5c..9e58ffbd88 100644 --- a/src/libsystemd/sd-bus/bus-control.c +++ b/src/libsystemd/sd-bus/bus-control.c @@ -264,7 +264,7 @@ static int kernel_get_list(sd_bus *bus, uint64_t flags, char ***x) { if ((flags & KDBUS_LIST_UNIQUE) && name->id != previous_id && !(name->flags & KDBUS_HELLO_ACTIVATOR)) { char *n; - if (asprintf(&n, ":1.%llu", (unsigned long long) name->id) < 0) { + if (asprintf(&n, ":1.%llu", name->id) < 0) { r = -ENOMEM; goto fail; } @@ -711,7 +711,7 @@ int bus_get_name_creds_kdbus( } if (mask & SD_BUS_CREDS_UNIQUE_NAME) { - if (asprintf(&c->unique_name, ":1.%llu", (unsigned long long) conn_info->id) < 0) { + if (asprintf(&c->unique_name, ":1.%llu", conn_info->id) < 0) { r = -ENOMEM; goto fail; } diff --git a/src/libsystemd/sd-bus/bus-creds.c b/src/libsystemd/sd-bus/bus-creds.c index c4f693dee9..349fa57f2d 100644 --- a/src/libsystemd/sd-bus/bus-creds.c +++ b/src/libsystemd/sd-bus/bus-creds.c @@ -30,7 +30,7 @@ #include "cgroup-util.h" #include "fd-util.h" #include "fileio.h" -#include "formats-util.h" +#include "format-util.h" #include "hexdecoct.h" #include "parse-util.h" #include "process-util.h" diff --git a/src/libsystemd/sd-bus/bus-dump.c b/src/libsystemd/sd-bus/bus-dump.c index 21a6b20a11..f117c98c11 100644 --- a/src/libsystemd/sd-bus/bus-dump.c +++ b/src/libsystemd/sd-bus/bus-dump.c @@ -25,7 +25,7 @@ #include "cap-list.h" #include "capability-util.h" #include "fileio.h" -#include "formats-util.h" +#include "format-util.h" #include "locale-util.h" #include "macro.h" #include "string-util.h" diff --git a/src/libsystemd/sd-bus/bus-kernel.c b/src/libsystemd/sd-bus/bus-kernel.c index 59398b841d..c82caeb3fc 100644 --- a/src/libsystemd/sd-bus/bus-kernel.c +++ b/src/libsystemd/sd-bus/bus-kernel.c @@ -42,7 +42,7 @@ #include "capability-util.h" #include "fd-util.h" #include "fileio.h" -#include "formats-util.h" +#include "format-util.h" #include "memfd-util.h" #include "parse-util.h" #include "stdio-util.h" @@ -848,8 +848,7 @@ static int bus_kernel_make_message(sd_bus *bus, struct kdbus_msg *k) { if (k->src_id == KDBUS_SRC_ID_KERNEL) bus_message_set_sender_driver(bus, m); else { - xsprintf(m->sender_buffer, ":1.%llu", - (unsigned long long)k->src_id); + xsprintf(m->sender_buffer, ":1.%llu", k->src_id); m->sender = m->creds.unique_name = m->sender_buffer; } @@ -860,8 +859,7 @@ static int bus_kernel_make_message(sd_bus *bus, struct kdbus_msg *k) { else if (k->dst_id == KDBUS_DST_ID_NAME) m->destination = bus->unique_name; /* fill in unique name if the well-known name is missing */ else { - xsprintf(m->destination_buffer, ":1.%llu", - (unsigned long long)k->dst_id); + xsprintf(m->destination_buffer, ":1.%llu", k->dst_id); m->destination = m->destination_buffer; } @@ -1035,7 +1033,7 @@ int bus_kernel_take_fd(sd_bus *b) { b->bloom_size = (size_t) bloom->size; b->bloom_n_hash = (unsigned) bloom->n_hash; - if (asprintf(&b->unique_name, ":1.%llu", (unsigned long long) hello->id) < 0) { + if (asprintf(&b->unique_name, ":1.%llu", hello->id) < 0) { r = -ENOMEM; goto fail; } @@ -1207,7 +1205,7 @@ int bus_kernel_write_message(sd_bus *bus, sd_bus_message *m, bool hint_sync_call return r; } } else { - log_debug("Ignoring message with unknown payload type %llu.", (unsigned long long) k->payload_type); + log_debug("Ignoring message with unknown payload type %llu.", k->payload_type); close_kdbus_msg(bus, k); } } @@ -1268,7 +1266,7 @@ static int translate_name_change( if (d->type == KDBUS_ITEM_NAME_ADD || (d->name_change.old_id.flags & (KDBUS_NAME_IN_QUEUE|KDBUS_NAME_ACTIVATOR))) old_owner[0] = 0; else - sprintf(old_owner, ":1.%llu", (unsigned long long) d->name_change.old_id.id); + sprintf(old_owner, ":1.%llu", d->name_change.old_id.id); if (d->type == KDBUS_ITEM_NAME_REMOVE || (d->name_change.new_id.flags & (KDBUS_NAME_IN_QUEUE|KDBUS_NAME_ACTIVATOR))) { @@ -1277,7 +1275,7 @@ static int translate_name_change( new_owner[0] = 0; } else - sprintf(new_owner, ":1.%llu", (unsigned long long) d->name_change.new_id.id); + sprintf(new_owner, ":1.%llu", d->name_change.new_id.id); return push_name_owner_changed(bus, d->name_change.name, old_owner, new_owner, ts); } @@ -1419,7 +1417,7 @@ int bus_kernel_read_message(sd_bus *bus, bool hint_priority, int64_t priority) { r = bus_kernel_translate_message(bus, k); close_kdbus_msg(bus, k); } else { - log_debug("Ignoring message with unknown payload type %llu.", (unsigned long long) k->payload_type); + log_debug("Ignoring message with unknown payload type %llu.", k->payload_type); r = 0; close_kdbus_msg(bus, k); } @@ -1649,7 +1647,7 @@ int bus_kernel_create_bus(const char *name, bool world, char **s) { if (s) { char *p; - p = strjoin("/sys/fs/kdbus/", n->str, "/bus", NULL); + p = strjoin("/sys/fs/kdbus/", n->str, "/bus"); if (!p) { safe_close(fd); return -ENOMEM; diff --git a/src/libsystemd/sd-bus/bus-socket.c b/src/libsystemd/sd-bus/bus-socket.c index cfd7753139..e6ed15eb71 100644 --- a/src/libsystemd/sd-bus/bus-socket.c +++ b/src/libsystemd/sd-bus/bus-socket.c @@ -30,7 +30,7 @@ #include "bus-message.h" #include "bus-socket.h" #include "fd-util.h" -#include "formats-util.h" +#include "format-util.h" #include "hexdecoct.h" #include "macro.h" #include "missing.h" diff --git a/src/libsystemd/sd-bus/busctl-introspect.c b/src/libsystemd/sd-bus/busctl-introspect.c index b09509f8e1..a05794941f 100644 --- a/src/libsystemd/sd-bus/busctl-introspect.c +++ b/src/libsystemd/sd-bus/busctl-introspect.c @@ -143,9 +143,7 @@ static int parse_xml_annotation(Context *context, uint64_t *flags) { case STATE_NAME: if (t == XML_ATTRIBUTE_VALUE) { - free(field); - field = name; - name = NULL; + free_and_replace(field, name); state = STATE_ANNOTATION; } else { @@ -158,9 +156,7 @@ static int parse_xml_annotation(Context *context, uint64_t *flags) { case STATE_VALUE: if (t == XML_ATTRIBUTE_VALUE) { - free(value); - value = name; - name = NULL; + free_and_replace(value, name); state = STATE_ANNOTATION; } else { @@ -194,6 +190,7 @@ static int parse_xml_node(Context *context, const char *prefix, unsigned n_depth STATE_SIGNAL_ARG, STATE_SIGNAL_ARG_NAME, STATE_SIGNAL_ARG_TYPE, + STATE_SIGNAL_ARG_DIRECTION, STATE_PROPERTY, STATE_PROPERTY_NAME, STATE_PROPERTY_TYPE, @@ -285,7 +282,7 @@ static int parse_xml_node(Context *context, const char *prefix, unsigned n_depth if (endswith(prefix, "/")) node_path = strappend(prefix, name); else - node_path = strjoin(prefix, "/", name, NULL); + node_path = strjoin(prefix, "/", name); if (!node_path) return log_oom(); } @@ -350,11 +347,8 @@ static int parse_xml_node(Context *context, const char *prefix, unsigned n_depth case STATE_INTERFACE_NAME: if (t == XML_ATTRIBUTE_VALUE) { - if (n_depth == 0) { - free(context->interface_name); - context->interface_name = name; - name = NULL; - } + if (n_depth == 0) + free_and_replace(context->interface_name, name); state = STATE_INTERFACE; } else { @@ -409,12 +403,8 @@ static int parse_xml_node(Context *context, const char *prefix, unsigned n_depth case STATE_METHOD_NAME: if (t == XML_ATTRIBUTE_VALUE) { - - if (n_depth == 0) { - free(context->member_name); - context->member_name = name; - name = NULL; - } + if (n_depth == 0) + free_and_replace(context->member_name, name); state = STATE_METHOD; } else { @@ -432,7 +422,7 @@ static int parse_xml_node(Context *context, const char *prefix, unsigned n_depth else if (streq_ptr(name, "type")) state = STATE_METHOD_ARG_TYPE; else if (streq_ptr(name, "direction")) - state = STATE_METHOD_ARG_DIRECTION; + state = STATE_METHOD_ARG_DIRECTION; else { log_error("Unexpected method <arg> attribute %s.", name); return -EBADMSG; @@ -458,7 +448,8 @@ static int parse_xml_node(Context *context, const char *prefix, unsigned n_depth } else if (streq(argument_direction, "out")) { if (!strextend(&context->member_result, argument_type, NULL)) return log_oom(); - } + } else + log_error("Unexpected method <arg> direction value '%s'.", argument_direction); } argument_type = mfree(argument_type); @@ -487,9 +478,7 @@ static int parse_xml_node(Context *context, const char *prefix, unsigned n_depth case STATE_METHOD_ARG_TYPE: if (t == XML_ATTRIBUTE_VALUE) { - free(argument_type); - argument_type = name; - name = NULL; + free_and_replace(argument_type, name); state = STATE_METHOD_ARG; } else { @@ -502,9 +491,7 @@ static int parse_xml_node(Context *context, const char *prefix, unsigned n_depth case STATE_METHOD_ARG_DIRECTION: if (t == XML_ATTRIBUTE_VALUE) { - free(argument_direction); - argument_direction = name; - name = NULL; + free_and_replace(argument_direction, name); state = STATE_METHOD_ARG; } else { @@ -559,12 +546,8 @@ static int parse_xml_node(Context *context, const char *prefix, unsigned n_depth case STATE_SIGNAL_NAME: if (t == XML_ATTRIBUTE_VALUE) { - - if (n_depth == 0) { - free(context->member_name); - context->member_name = name; - name = NULL; - } + if (n_depth == 0) + free_and_replace(context->member_name, name); state = STATE_SIGNAL; } else { @@ -582,6 +565,8 @@ static int parse_xml_node(Context *context, const char *prefix, unsigned n_depth state = STATE_SIGNAL_ARG_NAME; else if (streq_ptr(name, "type")) state = STATE_SIGNAL_ARG_TYPE; + else if (streq_ptr(name, "direction")) + state = STATE_SIGNAL_ARG_DIRECTION; else { log_error("Unexpected signal <arg> attribute %s.", name); return -EBADMSG; @@ -599,8 +584,11 @@ static int parse_xml_node(Context *context, const char *prefix, unsigned n_depth (t == XML_TAG_CLOSE && streq_ptr(name, "arg"))) { if (argument_type) { - if (!strextend(&context->member_signature, argument_type, NULL)) - return log_oom(); + if (!argument_direction || streq(argument_direction, "out")) { + if (!strextend(&context->member_signature, argument_type, NULL)) + return log_oom(); + } else + log_error("Unexpected signal <arg> direction value '%s'.", argument_direction); argument_type = mfree(argument_type); } @@ -627,9 +615,7 @@ static int parse_xml_node(Context *context, const char *prefix, unsigned n_depth case STATE_SIGNAL_ARG_TYPE: if (t == XML_ATTRIBUTE_VALUE) { - free(argument_type); - argument_type = name; - name = NULL; + free_and_replace(argument_type, name); state = STATE_SIGNAL_ARG; } else { @@ -639,6 +625,19 @@ static int parse_xml_node(Context *context, const char *prefix, unsigned n_depth break; + case STATE_SIGNAL_ARG_DIRECTION: + + if (t == XML_ATTRIBUTE_VALUE) { + free_and_replace(argument_direction, name); + + state = STATE_SIGNAL_ARG; + } else { + log_error("Unexpected token in signal <arg>. (4)"); + return -EINVAL; + } + + break; + case STATE_PROPERTY: if (t == XML_ATTRIBUTE_NAME) { @@ -688,12 +687,9 @@ static int parse_xml_node(Context *context, const char *prefix, unsigned n_depth case STATE_PROPERTY_NAME: if (t == XML_ATTRIBUTE_VALUE) { + if (n_depth == 0) + free_and_replace(context->member_name, name); - if (n_depth == 0) { - free(context->member_name); - context->member_name = name; - name = NULL; - } state = STATE_PROPERTY; } else { log_error("Unexpected token in <property>. (2)"); @@ -705,12 +701,8 @@ static int parse_xml_node(Context *context, const char *prefix, unsigned n_depth case STATE_PROPERTY_TYPE: if (t == XML_ATTRIBUTE_VALUE) { - - if (n_depth == 0) { - free(context->member_signature); - context->member_signature = name; - name = NULL; - } + if (n_depth == 0) + free_and_replace(context->member_signature, name); state = STATE_PROPERTY; } else { diff --git a/src/libsystemd/sd-bus/busctl.c b/src/libsystemd/sd-bus/busctl.c index 2c3f591053..9dd3828364 100644 --- a/src/libsystemd/sd-bus/busctl.c +++ b/src/libsystemd/sd-bus/busctl.c @@ -1102,7 +1102,7 @@ static int monitor(sd_bus *bus, char *argv[], int (*dump)(sd_bus_message *m, FIL return -EINVAL; } - m = strjoin("sender='", *i, "'", NULL); + m = strjoin("sender='", *i, "'"); if (!m) return log_oom(); @@ -1111,7 +1111,7 @@ static int monitor(sd_bus *bus, char *argv[], int (*dump)(sd_bus_message *m, FIL return bus_log_create_error(r); free(m); - m = strjoin("destination='", *i, "'", NULL); + m = strjoin("destination='", *i, "'"); if (!m) return log_oom(); diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c index d746348544..e809942278 100644 --- a/src/libsystemd/sd-bus/sd-bus.c +++ b/src/libsystemd/sd-bus/sd-bus.c @@ -1339,7 +1339,7 @@ int bus_set_address_system_remote(sd_bus *b, const char *host) { return -ENOMEM; } - b->address = strjoin("unixexec:path=ssh,argv1=-xT,argv2=", e, ",argv3=systemd-stdio-bridge", c, NULL); + b->address = strjoin("unixexec:path=ssh,argv1=-xT,argv2=", e, ",argv3=systemd-stdio-bridge", c); if (!b->address) return -ENOMEM; @@ -1387,7 +1387,7 @@ int bus_set_address_system_machine(sd_bus *b, const char *machine) { if (!e) return -ENOMEM; - b->address = strjoin("x-machine-kernel:machine=", e, ";x-machine-unix:machine=", e, NULL); + b->address = strjoin("x-machine-kernel:machine=", e, ";x-machine-unix:machine=", e); if (!b->address) return -ENOMEM; @@ -3470,7 +3470,7 @@ _public_ int sd_bus_path_encode(const char *prefix, const char *external_id, cha if (!e) return -ENOMEM; - ret = strjoin(prefix, "/", e, NULL); + ret = strjoin(prefix, "/", e); if (!ret) return -ENOMEM; diff --git a/src/libsystemd/sd-bus/test-bus-chat.c b/src/libsystemd/sd-bus/test-bus-chat.c index fc60830059..0fc6fc90ed 100644 --- a/src/libsystemd/sd-bus/test-bus-chat.c +++ b/src/libsystemd/sd-bus/test-bus-chat.c @@ -30,7 +30,7 @@ #include "bus-match.h" #include "bus-util.h" #include "fd-util.h" -#include "formats-util.h" +#include "format-util.h" #include "log.h" #include "macro.h" #include "util.h" diff --git a/src/libsystemd/sd-bus/test-bus-creds.c b/src/libsystemd/sd-bus/test-bus-creds.c index 6fdcfa4128..64bd76a576 100644 --- a/src/libsystemd/sd-bus/test-bus-creds.c +++ b/src/libsystemd/sd-bus/test-bus-creds.c @@ -31,7 +31,7 @@ int main(int argc, char *argv[]) { log_parse_environment(); log_open(); - if (cg_all_unified() == -ENOMEDIUM) { + if (cg_unified_flush() == -ENOMEDIUM) { log_info("Skipping test: /sys/fs/cgroup/ not available"); return EXIT_TEST_SKIP; } diff --git a/src/libsystemd/sd-bus/test-bus-objects.c b/src/libsystemd/sd-bus/test-bus-objects.c index f11cafd888..233a21a523 100644 --- a/src/libsystemd/sd-bus/test-bus-objects.c +++ b/src/libsystemd/sd-bus/test-bus-objects.c @@ -49,7 +49,7 @@ static int something_handler(sd_bus_message *m, void *userdata, sd_bus_error *er r = sd_bus_message_read(m, "s", &s); assert_se(r > 0); - n = strjoin("<<<", s, ">>>", NULL); + n = strjoin("<<<", s, ">>>"); assert_se(n); free(c->something); |