X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fquotacheck.c;h=b6648b836960b800e4065845640c487e44bb5aea;hp=a579c5e8b713727cd9c7476dff17dd6b2c1aac0c;hb=304b9f30781b8625c1f84fd27205f2707d4843b1;hpb=3d20ed6d51e38968cd646e2b3b24f36673408024 diff --git a/src/quotacheck.c b/src/quotacheck.c index a579c5e8b..b6648b836 100644 --- a/src/quotacheck.c +++ b/src/quotacheck.c @@ -26,6 +26,7 @@ #include #include "util.h" +#include "virt.h" static bool arg_skip = false; static bool arg_force = false; @@ -35,6 +36,9 @@ static int parse_proc_cmdline(void) { int r; size_t l; + if (detect_container(NULL) > 0) + return 0; + if ((r = read_one_line_file("/proc/cmdline", &line)) < 0) { log_warning("Failed to read /proc/cmdline, ignoring: %s", strerror(-r)); return 0; @@ -50,7 +54,7 @@ static int parse_proc_cmdline(void) { arg_skip = true; else if (startswith(w, "quotacheck.mode")) log_warning("Invalid quotacheck.mode= parameter. Ignoring."); -#ifdef TARGET_FEDORA +#if defined(TARGET_FEDORA) || defined(TARGET_MANDRIVA) || defined(TARGET_MAGEIA) else if (strneq(w, "forcequotacheck", l)) arg_force = true; #endif @@ -61,9 +65,9 @@ static int parse_proc_cmdline(void) { } static void test_files(void) { -#ifdef TARGET_FEDORA - /* This exists only on Fedora */ - if (access("/forcequoatcheck", F_OK) >= 0) +#if defined(TARGET_FEDORA) || defined(TARGET_MANDRIVA) || defined(TARGET_MAGEIA) + /* This exists only on Fedora, Mandriva or Mageia */ + if (access("/forcequotacheck", F_OK) >= 0) arg_force = true; #endif } @@ -83,19 +87,20 @@ int main(int argc, char *argv[]) { return EXIT_FAILURE; } - log_set_target(LOG_TARGET_SYSLOG_OR_KMSG); + log_set_target(LOG_TARGET_AUTO); log_parse_environment(); log_open(); + umask(0022); + parse_proc_cmdline(); test_files(); if (!arg_force) { - if (arg_skip) return 0; - if (access("/dev/.systemd/quotacheck", F_OK) < 0) + if (access("/run/systemd/quotacheck", F_OK) < 0) return 0; } @@ -108,7 +113,7 @@ int main(int argc, char *argv[]) { _exit(1); /* Operational error */ } - r = wait_for_terminate_and_warn("quotacheck", pid) >= 0 ? EXIT_SUCCESS : EXIT_FAILURE; + r = wait_for_terminate_and_warn("quotacheck", pid) == 0 ? EXIT_SUCCESS : EXIT_FAILURE; finish: return r;