]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
logind: turn of stdio locking when writing session files too
authorLennart Poettering <lennart@poettering.net>
Fri, 3 Aug 2018 18:18:55 +0000 (20:18 +0200)
committerLennart Poettering <lennart@poettering.net>
Sat, 13 Oct 2018 10:59:29 +0000 (12:59 +0200)
This just copies what we already do for user and seat files to session
files.

src/login/logind-session.c

index 6c447f5534298a07a6d55f9cad54102c9a76d286..b2a496279bbf13979c8515284f36a1ccf8b1e7d8 100644 (file)
@@ -5,6 +5,7 @@
 #include <linux/kd.h>
 #include <linux/vt.h>
 #include <signal.h>
+#include <stdio_ext.h>
 #include <string.h>
 #include <sys/ioctl.h>
 #include <unistd.h>
@@ -175,9 +176,8 @@ int session_save(Session *s) {
         if (r < 0)
                 goto fail;
 
-        assert(s->user);
-
-        fchmod(fileno(f), 0644);
+        (void) __fsetlocking(f, FSETLOCKING_BYCALLER);
+        (void) fchmod(fileno(f), 0644);
 
         fprintf(f,
                 "# This is private data. Do not parse.\n"