diff options
Diffstat (limited to 'src/user-sessions/user-sessions.c')
-rw-r--r-- | src/user-sessions/user-sessions.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/user-sessions/user-sessions.c b/src/user-sessions/user-sessions.c index ddeb310c3c..7c736c44d2 100644 --- a/src/user-sessions/user-sessions.c +++ b/src/user-sessions/user-sessions.c @@ -42,10 +42,9 @@ int main(int argc, char*argv[]) { if (streq(argv[1], "start")) { int r = 0; - if (unlink("/run/nologin") < 0 && errno != ENOENT) { - log_error_errno(errno, "Failed to remove /run/nologin file: %m"); - r = -errno; - } + if (unlink("/run/nologin") < 0 && errno != ENOENT) + r = log_error_errno(errno, + "Failed to remove /run/nologin file: %m"); if (unlink("/etc/nologin") < 0 && errno != ENOENT) { /* If the file doesn't exist and /etc simply @@ -65,7 +64,7 @@ int main(int argc, char*argv[]) { } else if (streq(argv[1], "stop")) { int r; - r = write_string_file("/run/nologin", "System is going down.", WRITE_STRING_FILE_ATOMIC); + r = write_string_file("/run/nologin", "System is going down.", WRITE_STRING_FILE_CREATE|WRITE_STRING_FILE_ATOMIC); if (r < 0) { log_error_errno(r, "Failed to create /run/nologin: %m"); return EXIT_FAILURE; |