summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2017-11-10 21:15:44 +0100
committerLennart Poettering <lennart@poettering.net>2017-11-10 21:15:44 +0100
commit0b3c84eb7da3a8c28ac248a68228f6a7edbb2e19 (patch)
tree94a7ea7f1aa53dd2b5b30813688029d4c2401bc6
parentd13b522751504e6ff5720200622265870dc9c1ad (diff)
downloadsystemd-0b3c84eb7da3a8c28ac248a68228f6a7edbb2e19.tar.gz
systemd-0b3c84eb7da3a8c28ac248a68228f6a7edbb2e19.tar.bz2
systemd-0b3c84eb7da3a8c28ac248a68228f6a7edbb2e19.zip
tree-wide: use _cleanup_(sd_bus_flush_close_unrefp) at various appropriate places
Let's shorten the code a bit.
-rw-r--r--src/busctl/busctl.c3
-rw-r--r--src/locale/localectl.c3
-rw-r--r--src/login/loginctl.c4
-rw-r--r--src/machine/machinectl.c3
-rw-r--r--src/mount/mount-tool.c2
-rw-r--r--src/timedate/timedatectl.c3
6 files changed, 5 insertions, 13 deletions
diff --git a/src/busctl/busctl.c b/src/busctl/busctl.c
index b38d6c7267..d41ccf30fe 100644
--- a/src/busctl/busctl.c
+++ b/src/busctl/busctl.c
@@ -2010,7 +2010,7 @@ static int busctl_main(sd_bus *bus, int argc, char *argv[]) {
}
int main(int argc, char *argv[]) {
- sd_bus *bus = NULL;
+ _cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
int r;
log_parse_environment();
@@ -2100,7 +2100,6 @@ int main(int argc, char *argv[]) {
r = busctl_main(bus, argc, argv);
finish:
- sd_bus_flush_close_unref(bus);
pager_close();
strv_free(arg_matches);
diff --git a/src/locale/localectl.c b/src/locale/localectl.c
index d9b060972d..2fef7d8c09 100644
--- a/src/locale/localectl.c
+++ b/src/locale/localectl.c
@@ -594,7 +594,7 @@ static int localectl_main(sd_bus *bus, int argc, char *argv[]) {
}
int main(int argc, char*argv[]) {
- sd_bus *bus = NULL;
+ _cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
int r;
setlocale(LC_ALL, "");
@@ -614,7 +614,6 @@ int main(int argc, char*argv[]) {
r = localectl_main(bus, argc, argv);
finish:
- sd_bus_flush_close_unref(bus);
pager_close();
return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
diff --git a/src/login/loginctl.c b/src/login/loginctl.c
index f3231bc0e4..3e917cb3f5 100644
--- a/src/login/loginctl.c
+++ b/src/login/loginctl.c
@@ -1584,7 +1584,7 @@ static int loginctl_main(int argc, char *argv[], sd_bus *bus) {
}
int main(int argc, char *argv[]) {
- sd_bus *bus = NULL;
+ _cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
int r;
setlocale(LC_ALL, "");
@@ -1607,8 +1607,6 @@ int main(int argc, char *argv[]) {
r = loginctl_main(argc, argv, bus);
finish:
- sd_bus_flush_close_unref(bus);
-
pager_close();
polkit_agent_close();
diff --git a/src/machine/machinectl.c b/src/machine/machinectl.c
index a44d75604a..8d78a0d3c0 100644
--- a/src/machine/machinectl.c
+++ b/src/machine/machinectl.c
@@ -3046,7 +3046,7 @@ static int machinectl_main(int argc, char *argv[], sd_bus *bus) {
}
int main(int argc, char*argv[]) {
- sd_bus *bus = NULL;
+ _cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
int r;
setlocale(LC_ALL, "");
@@ -3069,7 +3069,6 @@ int main(int argc, char*argv[]) {
r = machinectl_main(argc, argv, bus);
finish:
- sd_bus_flush_close_unref(bus);
pager_close();
polkit_agent_close();
diff --git a/src/mount/mount-tool.c b/src/mount/mount-tool.c
index 599abf093f..79dab5037a 100644
--- a/src/mount/mount-tool.c
+++ b/src/mount/mount-tool.c
@@ -1619,8 +1619,6 @@ int main(int argc, char* argv[]) {
}
finish:
- bus = sd_bus_flush_close_unref(bus);
-
pager_close();
free(arg_mount_what);
diff --git a/src/timedate/timedatectl.c b/src/timedate/timedatectl.c
index 6fe9422f94..5121dd153a 100644
--- a/src/timedate/timedatectl.c
+++ b/src/timedate/timedatectl.c
@@ -472,7 +472,7 @@ static int timedatectl_main(sd_bus *bus, int argc, char *argv[]) {
}
int main(int argc, char *argv[]) {
- sd_bus *bus = NULL;
+ _cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
int r;
setlocale(LC_ALL, "");
@@ -492,7 +492,6 @@ int main(int argc, char *argv[]) {
r = timedatectl_main(bus, argc, argv);
finish:
- sd_bus_flush_close_unref(bus);
pager_close();
return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;