From 138715dc1231c3c255afdc307a23ca87a04ef31a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Tue, 20 Nov 2018 16:41:38 +0100 Subject: [PATCH] udevadm: define main through macro This removes a call to log_close(). I don't think this should matter. The call to mac_selinux_init() is moved after parse_argv(). We probably don't need selinux when printing help(). --- src/udev/udevadm.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/udev/udevadm.c b/src/udev/udevadm.c index 1e1a92e138c..1125c54b9f5 100644 --- a/src/udev/udevadm.c +++ b/src/udev/udevadm.c @@ -6,6 +6,7 @@ #include #include "alloc-util.h" +#include "main-func.h" #include "pretty-print.h" #include "selinux-util.h" #include "string-util.h" @@ -106,24 +107,20 @@ static int udevadm_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; udev_parse_config(); log_parse_environment(); log_open(); log_set_max_level_realm(LOG_REALM_SYSTEMD, log_get_max_level()); - mac_selinux_init(); r = parse_argv(argc, argv); if (r <= 0) - goto finish; + return r; - r = udevadm_main(argc, argv); - -finish: - mac_selinux_finish(); - log_close(); - - return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS; + mac_selinux_init(); + return udevadm_main(argc, argv); } + +DEFINE_MAIN_FUNCTION(run);