chiark / gitweb /
main: warn if /etc/mtab is not a symlink
authorLennart Poettering <lennart@poettering.net>
Wed, 10 Nov 2010 22:18:34 +0000 (23:18 +0100)
committerLennart Poettering <lennart@poettering.net>
Wed, 10 Nov 2010 22:18:34 +0000 (23:18 +0100)
TODO
src/main.c

diff --git a/TODO b/TODO
index a97ba9f16844a87777795aa8a347ce285ed871e1..3264bbfa05a65e33b4e290f22c354bf14c49501a 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,5 +1,3 @@
-* print error if /etc/mtab is not a symlink to /proc/self/mounts
-
 * oneshot services which do not remain: 'exited' instead of 'dead'?
   it should be visible in 'systemctl' that they have been run
 
index ea2f0c1a9ecf3dc378257885ef96a86a34c7d86e..71e684b1bda9f34cb5889c41bc30ff7a683ea3eb 100644 (file)
@@ -890,6 +890,24 @@ static struct dual_timestamp* parse_initrd_timestamp(struct dual_timestamp *t) {
         return t;
 }
 
+static void test_mtab(void) {
+        char *p;
+
+        if (readlink_malloc("/etc/mtab", &p) >= 0) {
+                bool b;
+
+                b = streq(p, "/proc/self/mounts");
+                free(p);
+
+                if (b)
+                        return;
+        }
+
+        log_error("/etc/mtab is not a symlink or not pointing to /proc/self/mounts. "
+                  "This is not supported anymore. "
+                  "Please make sure to replace this file by a symlink to avoid incorrect or misleading mount(8) output.");
+}
+
 int main(int argc, char *argv[]) {
         Manager *m = NULL;
         int r, retval = EXIT_FAILURE;
@@ -1048,6 +1066,8 @@ int main(int argc, char *argv[]) {
                 loopback_setup();
 
                 mkdir_p("/dev/.systemd/ask-password/", 0755);
+
+                test_mtab();
         }
 
         if ((r = manager_new(arg_running_as, &m)) < 0) {