diff options
author | Lennart Poettering <lennart@poettering.net> | 2018-11-19 15:28:17 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-19 15:28:17 +0100 |
commit | 2a44bf5099d4b13d90d4a6c93b404894960487ee (patch) | |
tree | 984ba8892e42155bfa981099270e5c7e2f49f51b /src/portable/portabled.c | |
parent | 2675747f3cdd6f1e6236bbb2f79abfa53fb307f1 (diff) | |
parent | 51e237864221f3edb0c0fb28684901f538341cb1 (diff) | |
download | systemd-2a44bf5099d4b13d90d4a6c93b404894960487ee.tar.gz |
Merge pull request #10811 from keszybz/define-main-through-macro
Define main through macro
Diffstat (limited to 'src/portable/portabled.c')
-rw-r--r-- | src/portable/portabled.c | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/src/portable/portabled.c b/src/portable/portabled.c index 53faa09bac..a853257bc0 100644 --- a/src/portable/portabled.c +++ b/src/portable/portabled.c @@ -122,7 +122,7 @@ static int manager_run(Manager *m) { check_idle, m); } -int main(int argc, char *argv[]) { +static int run(int argc, char *argv[]) { _cleanup_(manager_unrefp) Manager *m = NULL; int r; @@ -134,35 +134,31 @@ int main(int argc, char *argv[]) { if (argc != 1) { log_error("This program takes no arguments."); - r = -EINVAL; - goto finish; + return -EINVAL; } assert_se(sigprocmask_many(SIG_BLOCK, NULL, SIGCHLD, SIGTERM, SIGINT, -1) >= 0); r = manager_new(&m); - if (r < 0) { - log_error_errno(r, "Failed to allocate manager object: %m"); - goto finish; - } + if (r < 0) + return log_error_errno(r, "Failed to allocate manager object: %m"); r = manager_startup(m); - if (r < 0) { - log_error_errno(r, "Failed to fully start up daemon: %m"); - goto finish; - } + if (r < 0) + return log_error_errno(r, "Failed to fully start up daemon: %m"); log_debug("systemd-portabled running as pid " PID_FMT, getpid_cached()); - sd_notify(false, "READY=1\n" "STATUS=Processing requests..."); r = manager_run(m); + (void) sd_notify(false, + "STOPPING=1\n" + "STATUS=Shutting down..."); log_debug("systemd-portabled stopped as pid " PID_FMT, getpid_cached()); - -finish: - return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS; - + return r; } + +DEFINE_MAIN_FUNCTION(run); |