summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-11-06 17:32:51 +0100
committerLennart Poettering <lennart@poettering.net>2013-11-06 17:32:51 +0100
commit84f6181c2ac99a0514ca5e0c8fc8c8e284caf789 (patch)
tree2496dfa8c63334faa132853647eb8acca415e752 /src
parent66b1e746055b9c56fd72c0451a4cfb2b06cf3f20 (diff)
clients: various simplifications
Diffstat (limited to 'src')
-rw-r--r--src/core/load-fragment.c3
-rw-r--r--src/hostname/hostnamectl.c2
-rw-r--r--src/locale/localectl.c12
-rw-r--r--src/machine/machinectl.c16
-rw-r--r--src/timedate/timedatectl.c12
5 files changed, 13 insertions, 32 deletions
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
index 4067930e30..b7e848c08f 100644
--- a/src/core/load-fragment.c
+++ b/src/core/load-fragment.c
@@ -34,8 +34,7 @@
#include <sys/time.h>
#include <sys/resource.h>
-#include <systemd/sd-messages.h>
-
+#include "sd-messages.h"
#include "unit.h"
#include "strv.h"
#include "conf-parser.h"
diff --git a/src/hostname/hostnamectl.c b/src/hostname/hostnamectl.c
index cc7db67d79..d8657fa4dd 100644
--- a/src/hostname/hostnamectl.c
+++ b/src/hostname/hostnamectl.c
@@ -458,8 +458,8 @@ static int hostnamectl_main(sd_bus *bus, int argc, char *argv[]) {
}
int main(int argc, char *argv[]) {
- int r;
_cleanup_bus_unref_ sd_bus *bus = NULL;
+ int r;
setlocale(LC_ALL, "");
log_parse_environment();
diff --git a/src/locale/localectl.c b/src/locale/localectl.c
index e3d98c4bd0..c70470fe00 100644
--- a/src/locale/localectl.c
+++ b/src/locale/localectl.c
@@ -794,33 +794,27 @@ static int localectl_main(sd_bus *bus, int argc, char *argv[]) {
}
int main(int argc, char*argv[]) {
- int r, ret = EXIT_FAILURE;
_cleanup_bus_unref_ sd_bus *bus = NULL;
+ int r;
setlocale(LC_ALL, "");
log_parse_environment();
log_open();
r = parse_argv(argc, argv);
- if (r < 0)
+ if (r <= 0)
goto finish;
- else if (r == 0) {
- ret = EXIT_SUCCESS;
- goto finish;
- }
r = bus_open_transport(arg_transport, arg_host, false, &bus);
if (r < 0) {
log_error("Failed to create bus connection: %s", strerror(-r));
- ret = EXIT_FAILURE;
goto finish;
}
r = localectl_main(bus, argc, argv);
- ret = r < 0 ? EXIT_FAILURE : r;
finish:
pager_close();
- return ret;
+ return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
}
diff --git a/src/machine/machinectl.c b/src/machine/machinectl.c
index 8468436646..ee802b1e8b 100644
--- a/src/machine/machinectl.c
+++ b/src/machine/machinectl.c
@@ -849,35 +849,29 @@ static int machinectl_main(sd_bus *bus, int argc, char *argv[]) {
}
int main(int argc, char*argv[]) {
- int r, ret = EXIT_FAILURE;
_cleanup_bus_unref_ sd_bus *bus = NULL;
+ int r;
setlocale(LC_ALL, "");
log_parse_environment();
log_open();
r = parse_argv(argc, argv);
- if (r < 0)
+ if (r <= 0)
goto finish;
- else if (r == 0) {
- ret = EXIT_SUCCESS;
- goto finish;
- }
r = bus_open_transport(arg_transport, arg_host, false, &bus);
if (r < 0) {
log_error("Failed to create bus connection: %s", strerror(-r));
- ret = EXIT_FAILURE;
goto finish;
}
r = machinectl_main(bus, argc, argv);
- ret = r < 0 ? EXIT_FAILURE : r;
finish:
- strv_free(arg_property);
-
pager_close();
- return ret;
+ strv_free(arg_property);
+
+ return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
}
diff --git a/src/timedate/timedatectl.c b/src/timedate/timedatectl.c
index 461540e89b..9926a8a880 100644
--- a/src/timedate/timedatectl.c
+++ b/src/timedate/timedatectl.c
@@ -581,33 +581,27 @@ static int timedatectl_main(sd_bus *bus, int argc, char *argv[]) {
}
int main(int argc, char *argv[]) {
- int r, ret = EXIT_FAILURE;
_cleanup_bus_unref_ sd_bus *bus = NULL;
+ int r;
setlocale(LC_ALL, "");
log_parse_environment();
log_open();
r = parse_argv(argc, argv);
- if (r < 0)
+ if (r <= 0)
goto finish;
- else if (r == 0) {
- ret = EXIT_SUCCESS;
- goto finish;
- }
r = bus_open_transport(arg_transport, arg_host, false, &bus);
if (r < 0) {
log_error("Failed to create bus connection: %s", strerror(-r));
- ret = EXIT_FAILURE;
goto finish;
}
r = timedatectl_main(bus, argc, argv);
- ret = r < 0 ? EXIT_FAILURE : r;
finish:
pager_close();
- return ret;
+ return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
}