diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-06-13 20:04:31 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-06-13 20:11:59 +0200 |
commit | 5b4c0131214cd99b7b4936b97c728ce0c5d9af32 (patch) | |
tree | 86a3e71eed682c7b1ae6e4dcf2b081c214f648f2 /src | |
parent | 6d1d50f0811a8d80d010cce521570446245f47cc (diff) |
core: don't complain at early boot if /etc/mtab is not the right symlink
When we boot up with an empty /etc it's ok if the symlink doesn't exist.
We will create it later with tmpfiles.
Diffstat (limited to 'src')
-rw-r--r-- | src/core/main.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/src/core/main.c b/src/core/main.c index 29f2d5a2a5..3aac5d1d97 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -1151,19 +1151,25 @@ static int bump_rlimit_nofile(struct rlimit *saved_rlimit) { } static void test_mtab(void) { - char *p; - /* Check that /etc/mtab is a symlink */ + static const char ok[] = + "/proc/self/mounts\0" + "/proc/mounts\0" + "../proc/self/mounts\0" + "../proc/mounts\0"; - if (readlink_malloc("/etc/mtab", &p) >= 0) { - bool b; + _cleanup_free_ char *p = NULL; + int r; - b = streq(p, "/proc/self/mounts") || streq(p, "/proc/mounts"); - free(p); + /* Check that /etc/mtab is a symlink to the right place or + * non-existing. But certainly not a file, or a symlink to + * some weird place... */ - if (b) - return; - } + r = readlink_malloc("/etc/mtab", &p); + if (r == -ENOENT) + return; + if (r >= 0 && nulstr_contains(ok, p)) + return; log_warning("/etc/mtab is not a symlink or not pointing to /proc/self/mounts. " "This is not supported anymore. " |