]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
user-sessions: fix write_string_file() fallout 643/head
authorDaniel Mack <daniel@zonque.org>
Mon, 20 Jul 2015 21:17:37 +0000 (23:17 +0200)
committerDaniel Mack <daniel@zonque.org>
Tue, 21 Jul 2015 13:59:02 +0000 (15:59 +0200)
WRITE_STRING_FILE_ATOMIC is only valid if WRITE_STRING_FILE_CREATE is also
given. IOW, an atomic file write operation is only possible when creating a
file is also being asked for.

This is a regression from the recent write_string_file() rework.

src/user-sessions/user-sessions.c

index ddeb310c3c9d2093ff034524d8b1cce06b50a8ef..e80a7771de6ae63d24bf65cc71aceedd08d8a935 100644 (file)
@@ -65,7 +65,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;