#include "label-util.h"
#include "parse-util.h"
#include "pretty-print.h"
+#include "selinux-util.h"
#include "static-destruct.h"
-static FILE* arg_serialization = NULL;
+static FILE *arg_serialization = NULL;
STATIC_DESTRUCTOR_REGISTER(arg_serialization, fclosep);
return 1 /* work to do */;
}
-int main(int argc, char *argv[]) {
+static int run(int argc, char *argv[]) {
_cleanup_fdset_free_ FDSet *fdset = NULL;
- int exit_status = EXIT_SUCCESS, r;
_cleanup_(cgroup_context_done) CGroupContext cgroup_context = {};
_cleanup_(exec_context_done) ExecContext context = {};
_cleanup_(exec_command_done) ExecCommand command = {};
.shared = &shared,
.dynamic_creds = &dynamic_creds,
};
+ int exit_status = EXIT_SUCCESS, r;
exec_context_init(&context);
cgroup_context_init(&cgroup_context);
- /* We use safe_fork() for spawning sd-pam helper process, which internally calls rename_process().
- * As the last step of renaming, all saved argvs are memzero()-ed. Hence, we need to save the argv
- * first to prevent showing "intense" cmdline. See #30352. */
- save_argc_argv(argc, argv);
-
/* We might be starting the journal itself, we'll be told by the caller what to do */
log_set_always_reopen_console(true);
log_set_prohibit_ipc(true);
return exit_status;
}
+
+int main(int argc, char *argv[]) {
+ int r;
+
+ /* We use safe_fork() for spawning sd-pam helper process, which internally calls rename_process().
+ * As the last step of renaming, all saved argvs are memzero()-ed. Hence, we need to save the argv
+ * first to prevent showing "intense" cmdline. See #30352. */
+ save_argc_argv(argc, argv);
+
+ r = run(argc, argv);
+
+ mac_selinux_finish();
+ static_destruct();
+
+ return r < 0 ? EXIT_FAILURE : r;
+}