1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-06 16:59:03 +03:00

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().
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2018-11-20 16:41:38 +01:00
parent 8d38b8ad56
commit 138715dc12

View File

@ -6,6 +6,7 @@
#include <stdio.h> #include <stdio.h>
#include "alloc-util.h" #include "alloc-util.h"
#include "main-func.h"
#include "pretty-print.h" #include "pretty-print.h"
#include "selinux-util.h" #include "selinux-util.h"
#include "string-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); return dispatch_verb(argc, argv, verbs, NULL);
} }
int main(int argc, char *argv[]) { static int run(int argc, char *argv[]) {
int r; int r;
udev_parse_config(); udev_parse_config();
log_parse_environment(); log_parse_environment();
log_open(); log_open();
log_set_max_level_realm(LOG_REALM_SYSTEMD, log_get_max_level()); log_set_max_level_realm(LOG_REALM_SYSTEMD, log_get_max_level());
mac_selinux_init();
r = parse_argv(argc, argv); r = parse_argv(argc, argv);
if (r <= 0) if (r <= 0)
goto finish; return r;
r = udevadm_main(argc, argv); mac_selinux_init();
return udevadm_main(argc, argv);
finish:
mac_selinux_finish();
log_close();
return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
} }
DEFINE_MAIN_FUNCTION(run);