From c118b577fa676f27a07725657e7b444234b6f0d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Tue, 20 Nov 2018 09:50:07 +0100 Subject: [PATCH] coredumpctl: define main through macro We want to propagate the return value from gdb, hence this commit makes use of the liberalization of DEFINE_MAIN_FUNCTION_WITH_POSITIVE_FAILURE() in previous commit. --- src/coredump/coredumpctl.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/coredump/coredumpctl.c b/src/coredump/coredumpctl.c index 906b45488a..4616a7e3e4 100644 --- a/src/coredump/coredumpctl.c +++ b/src/coredump/coredumpctl.c @@ -23,6 +23,7 @@ #include "journal-util.h" #include "log.h" #include "macro.h" +#include "main-func.h" #include "pager.h" #include "parse-util.h" #include "path-util.h" @@ -1066,7 +1067,7 @@ static int coredumpctl_main(int argc, char *argv[]) { return dispatch_verb(argc, argv, verbs, NULL); } -int main(int argc, char *argv[]) { +static int run(int argc, char *argv[]) { int r, units_active; setlocale(LC_ALL, ""); @@ -1078,7 +1079,7 @@ int main(int argc, char *argv[]) { r = parse_argv(argc, argv); if (r <= 0) - goto end; + return r; sigbus_install(); @@ -1091,8 +1092,7 @@ int main(int argc, char *argv[]) { ansi_highlight_red(), units_active, units_active == 1 ? "unit is running" : "units are running", ansi_normal()); -end: - pager_close(); - - return r >= 0 ? r : EXIT_FAILURE; + return r; } + +DEFINE_MAIN_FUNCTION_WITH_POSITIVE_FAILURE(run);