#include <stdlib.h>
#include "pager.h"
+#include "spawn-ask-password-agent.h"
#include "spawn-polkit-agent.h"
#include "static-destruct.h"
int r; \
r = impl(argc, argv); \
static_destruct(); \
+ ask_password_agent_close(); \
polkit_agent_close(); \
pager_close(); \
return ret; \
#include "log.h"
#include "logs-show.h"
#include "macro.h"
+#include "main-func.h"
#include "mkdir.h"
#include "pager.h"
#include "parse-util.h"
#endif
}
-int main(int argc, char*argv[]) {
+static int run(int argc, char*argv[]) {
int r;
argv_cmdline = argv[0];
goto finish;
if (arg_action != ACTION_SYSTEMCTL && running_in_chroot() > 0) {
-
if (!arg_quiet)
log_info("Running in chroot, ignoring request.");
r = 0;
finish:
release_busses();
- pager_close();
- ask_password_agent_close();
- polkit_agent_close();
-
strv_free(arg_types);
strv_free(arg_states);
strv_free(arg_properties);
free(arg_root);
free(arg_esp_path);
- /* Note that we return r here, not EXIT_SUCCESS, so that we can implement the LSB-like return codes */
- return r < 0 ? EXIT_FAILURE : r;
+ /* Note that we return r here, not 0, so that we can implement the LSB-like return codes */
+ return r;
}
+
+DEFINE_MAIN_FUNCTION_WITH_POSITIVE_FAILURE(run);