chiark / gitweb /
logind: move logind into its own subdirectory
[elogind.git] / src / quotacheck.c
index da2da3b2e05adca5ddcc79ec6452ab0d0e444e51..60033a8eb256275c2df03b51b1cf4a5ad31cfde5 100644 (file)
@@ -26,6 +26,7 @@
 #include <unistd.h>
 
 #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.");
-#if defined(TARGET_FEDORA) || defined(TARGET_MANDRIVA)
+#if defined(TARGET_FEDORA) || defined(TARGET_MANDRIVA) || defined(TARGET_MAGEIA)
                 else if (strneq(w, "forcequotacheck", l))
                         arg_force = true;
 #endif
@@ -61,8 +65,8 @@ static int parse_proc_cmdline(void) {
 }
 
 static void test_files(void) {
-#if defined(TARGET_FEDORA) || defined(TARGET_MANDRIVA)
-        /* This exists only on Fedora or Mandriva */
+#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
@@ -87,6 +91,8 @@ int main(int argc, char *argv[]) {
         log_parse_environment();
         log_open();
 
+        umask(0022);
+
         parse_proc_cmdline();
         test_files();
 
@@ -94,7 +100,7 @@ int main(int argc, char *argv[]) {
                 if (arg_skip)
                         return 0;
 
-                if (access("/dev/.run/systemd/quotacheck", F_OK) < 0)
+                if (access("/run/systemd/quotacheck", F_OK) < 0)
                         return 0;
         }