b12df0
From 3eab0f1b64477792bd01ca52c3eb26ce64c5c7ba Mon Sep 17 00:00:00 2001
b12df0
From: Lennart Poettering <lennart@poettering.net>
b12df0
Date: Fri, 3 Aug 2018 20:18:55 +0200
b12df0
Subject: [PATCH] logind: turn of stdio locking when writing session files too
b12df0
b12df0
This just copies what we already do for user and seat files to session
b12df0
files.
b12df0
b12df0
(cherry picked from commit 44176400138e18d9087e0864ca97041416a90d47)
b12df0
b12df0
Related: #1642460
b12df0
---
b12df0
 src/login/logind-session.c | 6 +++---
b12df0
 1 file changed, 3 insertions(+), 3 deletions(-)
b12df0
b12df0
diff --git a/src/login/logind-session.c b/src/login/logind-session.c
b12df0
index 0afb065b2b..960a24d1a7 100644
b12df0
--- a/src/login/logind-session.c
b12df0
+++ b/src/login/logind-session.c
b12df0
@@ -5,6 +5,7 @@
b12df0
 #include <linux/kd.h>
b12df0
 #include <linux/vt.h>
b12df0
 #include <signal.h>
b12df0
+#include <stdio_ext.h>
b12df0
 #include <string.h>
b12df0
 #include <sys/ioctl.h>
b12df0
 #include <unistd.h>
b12df0
@@ -175,9 +176,8 @@ int session_save(Session *s) {
b12df0
         if (r < 0)
b12df0
                 goto fail;
b12df0
 
b12df0
-        assert(s->user);
b12df0
-
b12df0
-        fchmod(fileno(f), 0644);
b12df0
+        (void) __fsetlocking(f, FSETLOCKING_BYCALLER);
b12df0
+        (void) fchmod(fileno(f), 0644);
b12df0
 
b12df0
         fprintf(f,
b12df0
                 "# This is private data. Do not parse.\n"