guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

02/05: shepherd: Ensure the log file has correct ownership.


From: guix-commits
Subject: 02/05: shepherd: Ensure the log file has correct ownership.
Date: Thu, 26 Sep 2019 17:15:58 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix.

commit 464caf72f9ff7600bd49e2df07e19cd9af28a930
Author: Ludovic Courtès <address@hidden>
Date:   Thu Sep 26 17:07:55 2019 +0200

    shepherd: Ensure the log file has correct ownership.
    
    * gnu/build/shepherd.scm (make-forkexec-constructor/container): Ensure
    LOG-FILE has correct ownership.
---
 gnu/build/shepherd.scm | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/gnu/build/shepherd.scm b/gnu/build/shepherd.scm
index 461feb0..14bdf4e 100644
--- a/gnu/build/shepherd.scm
+++ b/gnu/build/shepherd.scm
@@ -150,7 +150,10 @@ namespace, in addition to essential bind-mounts such 
/proc."
     (when log-file
       ;; Create LOG-FILE so we can map it in the container.
       (unless (file-exists? log-file)
-        (call-with-output-file log-file (const #t))))
+        (call-with-output-file log-file (const #t))
+        (when user
+          (let ((pw (getpwnam user)))
+            (chown log-file (passwd:uid pw) (passwd:gid pw))))))
 
     (let ((pid (run-container container-directory
                               mounts namespaces 1



reply via email to

[Prev in Thread] Current Thread [Next in Thread]