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.
This commit is contained in:
@@ -23,6 +23,7 @@
|
|||||||
#include "journal-util.h"
|
#include "journal-util.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "macro.h"
|
#include "macro.h"
|
||||||
|
#include "main-func.h"
|
||||||
#include "pager.h"
|
#include "pager.h"
|
||||||
#include "parse-util.h"
|
#include "parse-util.h"
|
||||||
#include "path-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);
|
return dispatch_verb(argc, argv, verbs, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
static int run(int argc, char *argv[]) {
|
||||||
int r, units_active;
|
int r, units_active;
|
||||||
|
|
||||||
setlocale(LC_ALL, "");
|
setlocale(LC_ALL, "");
|
||||||
@@ -1078,7 +1079,7 @@ int main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
r = parse_argv(argc, argv);
|
r = parse_argv(argc, argv);
|
||||||
if (r <= 0)
|
if (r <= 0)
|
||||||
goto end;
|
return r;
|
||||||
|
|
||||||
sigbus_install();
|
sigbus_install();
|
||||||
|
|
||||||
@@ -1091,8 +1092,7 @@ int main(int argc, char *argv[]) {
|
|||||||
ansi_highlight_red(),
|
ansi_highlight_red(),
|
||||||
units_active, units_active == 1 ? "unit is running" : "units are running",
|
units_active, units_active == 1 ? "unit is running" : "units are running",
|
||||||
ansi_normal());
|
ansi_normal());
|
||||||
end:
|
return r;
|
||||||
pager_close();
|
|
||||||
|
|
||||||
return r >= 0 ? r : EXIT_FAILURE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEFINE_MAIN_FUNCTION_WITH_POSITIVE_FAILURE(run);
|
||||||
|
|||||||
Reference in New Issue
Block a user