1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-25 01:34:28 +03:00

hostnamectl: define main through macro

This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2018-11-16 11:23:02 +01:00
parent 9013653e3c
commit 43ead4114b

View File

@ -426,7 +426,7 @@ static int hostnamectl_main(sd_bus *bus, int argc, char *argv[]) {
return dispatch_verb(argc, argv, verbs, bus);
}
int main(int argc, char *argv[]) {
static int run(int argc, char *argv[]) {
_cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
int r;
@ -436,16 +436,13 @@ int main(int argc, char *argv[]) {
r = parse_argv(argc, argv);
if (r <= 0)
goto finish;
return r;
r = bus_connect_transport(arg_transport, arg_host, false, &bus);
if (r < 0) {
log_error_errno(r, "Failed to create bus connection: %m");
goto finish;
}
if (r < 0)
return log_error_errno(r, "Failed to create bus connection: %m");
r = hostnamectl_main(bus, argc, argv);
finish:
return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
return hostnamectl_main(bus, argc, argv);
}
DEFINE_MAIN_FUNCTION(run);