diff options
author | Lennart Poettering <lennart@poettering.net> | 2011-05-10 18:55:39 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2011-05-10 18:55:39 +0200 |
commit | bd118f8e2262d5703120442aa48bd942d2116b75 (patch) | |
tree | b92734bdf5641b7b20df4eaa6b62d6a337aa98f2 /src | |
parent | e4c1d706bdea47c2a61e626e66ca3e8489c9f08e (diff) |
user-sessions: ignore EROFS when unlinking /etc/nologin if the file doesn't exist anyway
Diffstat (limited to 'src')
-rw-r--r-- | src/user-sessions.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/user-sessions.c b/src/user-sessions.c index 4518d953ed..e045b88c10 100644 --- a/src/user-sessions.c +++ b/src/user-sessions.c @@ -48,8 +48,16 @@ int main(int argc, char*argv[]) { } if (unlink("/etc/nologin") < 0 && errno != ENOENT) { - log_error("Failed to remove /etc/nologin file: %m"); - q = -errno; + + /* If the file doesn't exist and /etc simply + * was read-only (in which case unlink() + * returns EROFS even if the file doesn't + * exist), don't complain */ + + if (errno != EROFS || access("/etc/nologin", F_OK) >= 0) { + log_error("Failed to remove /etc/nologin file: %m"); + q = -errno; + } } if (r < 0 || q < 0) |