X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Flibsystemd%2Fsd-bus%2Ftest-bus-match.c;h=6c5d35b3d326f312ee03f35b96793e24b1a246a2;hb=412c18f10c9df3f0a02358d8c0e707ed2e5fa186;hp=a62de502f94cc4afcbd169fa07a94b1f19829c0a;hpb=19befb2d5fc087f96e40ddc432b2cc9385666209;p=elogind.git diff --git a/src/libsystemd/sd-bus/test-bus-match.c b/src/libsystemd/sd-bus/test-bus-match.c index a62de502f..6c5d35b3d 100644 --- a/src/libsystemd/sd-bus/test-bus-match.c +++ b/src/libsystemd/sd-bus/test-bus-match.c @@ -80,13 +80,19 @@ static int match_add(sd_bus_slot *slots, struct bus_match_node *root, const char } int main(int argc, char *argv[]) { - struct bus_match_node root; + struct bus_match_node root = { + .type = BUS_MATCH_ROOT, + }; + _cleanup_bus_message_unref_ sd_bus_message *m = NULL; + _cleanup_bus_unref_ sd_bus *bus = NULL; enum bus_match_node_type i; sd_bus_slot slots[15]; + int r; - zero(root); - root.type = BUS_MATCH_ROOT; + r = sd_bus_open_system(&bus); + if (r < 0) + return EXIT_TEST_SKIP; assert_se(match_add(slots, &root, "arg2='wal\\'do',sender='foo',type='signal',interface='bar.x',", 1) >= 0); assert_se(match_add(slots, &root, "arg2='wal\\'do2',sender='foo',type='signal',interface='bar.x',", 2) >= 0); @@ -105,7 +111,7 @@ int main(int argc, char *argv[]) { bus_match_dump(&root, 0); - assert_se(sd_bus_message_new_signal(NULL, &m, "/foo/bar", "bar.x", "waldo") >= 0); + assert_se(sd_bus_message_new_signal(bus, &m, "/foo/bar", "bar.x", "waldo") >= 0); assert_se(sd_bus_message_append(m, "ssss", "one", "two", "/prefix/three", "prefix.four") >= 0); assert_se(bus_message_seal(m, 1, 0) >= 0);