1 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
4 This file is part of systemd.
6 Copyright 2010 Lennart Poettering
8 systemd is free software; you can redistribute it and/or modify it
9 under the terms of the GNU Lesser General Public License as published by
10 the Free Software Foundation; either version 2.1 of the License, or
11 (at your option) any later version.
13 systemd is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
18 You should have received a copy of the GNU Lesser General Public License
19 along with systemd; If not, see <http://www.gnu.org/licenses/>.
29 static bool arg_skip = false;
30 static bool arg_force = false;
32 static int parse_proc_cmdline_item(const char *key, const char *value) {
34 if (streq(key, "quotacheck.mode") && value) {
36 if (streq(value, "auto"))
37 arg_force = arg_skip = false;
38 else if (streq(value, "force"))
40 else if (streq(value, "skip"))
43 log_warning("Invalid quotacheck.mode= parameter '%s'. Ignoring.", value);
49 static void test_files(void) {
52 int main(int argc, char *argv[]) {
54 static const char * const cmdline[] = {
64 log_error("This program takes no arguments.");
68 log_set_target(LOG_TARGET_AUTO);
69 log_parse_environment();
74 r = parse_proc_cmdline(parse_proc_cmdline_item);
76 log_warning_errno(r, "Failed to parse kernel command line, ignoring: %m");
84 if (access("/run/systemd/quotacheck", F_OK) < 0)
90 log_error_errno(errno, "fork(): %m");
92 } else if (pid == 0) {
94 execv(cmdline[0], (char**) cmdline);
95 _exit(1); /* Operational error */
98 r = wait_for_terminate_and_warn("quotacheck", pid, true);
100 return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;