diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2018-11-16 14:57:46 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2018-11-17 09:13:35 +0100 |
commit | 2ab2a55bd60584962e18642109c5bf8c3297f673 (patch) | |
tree | c5b7bd5788ab73f3da18f469310f92584689539c /src/quotacheck | |
parent | portabled: add missing STOPPING=1 notification (diff) | |
download | systemd-2ab2a55bd60584962e18642109c5bf8c3297f673.tar.xz systemd-2ab2a55bd60584962e18642109c5bf8c3297f673.zip |
quotacheck: configure logging before use and define main through macro
Diffstat (limited to 'src/quotacheck')
-rw-r--r-- | src/quotacheck/quotacheck.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/quotacheck/quotacheck.c b/src/quotacheck/quotacheck.c index d891f18b65..e3c50c366a 100644 --- a/src/quotacheck/quotacheck.c +++ b/src/quotacheck/quotacheck.c @@ -52,18 +52,18 @@ static void test_files(void) { #endif } -int main(int argc, char *argv[]) { +static int run(int argc, char *argv[]) { int r; - if (argc > 1) { - log_error("This program takes no arguments."); - return EXIT_FAILURE; - } - log_set_target(LOG_TARGET_AUTO); log_parse_environment(); log_open(); + if (argc > 1) { + log_error("This program takes no arguments."); + return -EINVAL; + } + umask(0022); r = proc_cmdline_parse(parse_proc_cmdline_item, NULL, 0); @@ -74,15 +74,15 @@ int main(int argc, char *argv[]) { if (!arg_force) { if (arg_skip) - return EXIT_SUCCESS; + return 0; if (access("/run/systemd/quotacheck", F_OK) < 0) - return EXIT_SUCCESS; + return 0; } r = safe_fork("(quotacheck)", FORK_RESET_SIGNALS|FORK_DEATHSIG|FORK_LOG|FORK_WAIT, NULL); if (r < 0) - goto finish; + return r; if (r == 0) { static const char * const cmdline[] = { QUOTACHECK, @@ -96,6 +96,7 @@ int main(int argc, char *argv[]) { _exit(EXIT_FAILURE); /* Operational error */ } -finish: - return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS; + return 0; } + +DEFINE_MAIN_FUNCTION(run); |