chiark / gitweb /
logind: fix write_string_file() fallout
authorDaniel Mack <daniel@zonque.org>
Mon, 20 Jul 2015 21:17:37 +0000 (23:17 +0200)
committerSven Eden <yamakuzure@gmx.net>
Tue, 14 Mar 2017 09:07:02 +0000 (10:07 +0100)
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/login/logind-dbus.c

index 049e33e2a6b48f61a5f2c8b35f12411ebe628e3e..e6371ff04d9a323e4af123047097c02e94102be0 100644 (file)
@@ -1774,7 +1774,7 @@ static int nologin_timeout_handler(
 
         log_info("Creating /run/nologin, blocking further logins...");
 
-        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");
         else