dryang / rpms / systemd

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