[systemd-commits] src/user-sessions.c
Lennart Poettering
lennart at kemper.freedesktop.org
Thu Oct 7 14:16:55 PDT 2010
src/user-sessions.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
New commits:
commit 4a8a5b2963fca71fca044dcdddc3f767f3cdbd17
Author: Lennart Poettering <lennart at poettering.net>
Date: Thu Oct 7 23:16:48 2010 +0200
user-sessions: properly unlink both nologin files
diff --git a/src/user-sessions.c b/src/user-sessions.c
index dc4ee0f..8026961 100644
--- a/src/user-sessions.c
+++ b/src/user-sessions.c
@@ -40,16 +40,21 @@ int main(int argc, char*argv[]) {
log_open();
if (streq(argv[1], "start")) {
+ int q = 0, r = 0;
- if (unlink("/var/run/nologin") < 0 ||
- unlink("/etc/nologin") < 0) {
+ if (unlink("/var/run/nologin") < 0 && errno != ENOENT) {
+ log_error("Failed to remove /var/run/nologin file: %m");
+ r = -errno;
+ }
- if (errno != ENOENT) {
- log_error("Failed to remove nologin files: %m");
- goto finish;
- }
+ if (unlink("/etc/nologin") < 0 && errno != ENOENT) {
+ log_error("Failed to remove /etc/nologin file: %m");
+ q = -errno;
}
+ if (r < 0 || q < 0)
+ goto finish;
+
} else if (streq(argv[1], "stop")) {
int r, q;
More information about the systemd-commits
mailing list