chiark / gitweb /
fileio: consolidate write_string_file*()
[elogind.git] / src / login / logind-dbus.c
index 640ae92f7f9cbdb1f8de6ca0a85c0450cce51fe0..dbe8cae6061088f3d6d060f24968c40d387b8b98 100644 (file)
@@ -690,6 +690,8 @@ static int method_create_session(sd_bus_message *message, void *userdata, sd_bus
         }
 
         manager_get_session_by_pid(m, leader, &session);
+        if (!session && vtnr > 0 && vtnr < m->seat0->position_count)
+                session = m->seat0->positions[vtnr];
         if (session) {
                 _cleanup_free_ char *path = NULL;
                 _cleanup_close_ int fifo_fd = -1;
@@ -1194,7 +1196,7 @@ static int trigger_device(Manager *m, struct udev_device *d) {
                 if (!t)
                         return -ENOMEM;
 
-                write_string_file(t, "change");
+                write_string_file(t, "change", WRITE_STRING_FILE_CREATE);
         }
 
         return 0;
@@ -1793,7 +1795,7 @@ static int nologin_timeout_handler(
 
         log_info("Creating /run/nologin, blocking further logins...");
 
-        r = write_string_file_atomic("/run/nologin", "System is going down.");
+        r = write_string_file("/run/nologin", "System is going down.", WRITE_STRING_FILE_ATOMIC);
         if (r < 0)
                 log_error_errno(r, "Failed to create /run/nologin: %m");
         else