shepherd: Ensure the log file has correct ownership.

* gnu/build/shepherd.scm (make-forkexec-constructor/container): Ensure
LOG-FILE has correct ownership.
This commit is contained in:
Ludovic Courtès 2019-09-26 17:07:55 +02:00
parent 0d3a4fc867
commit 464caf72f9
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -150,7 +150,10 @@ (define mounts
(when log-file (when log-file
;; Create LOG-FILE so we can map it in the container. ;; Create LOG-FILE so we can map it in the container.
(unless (file-exists? log-file) (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 (let ((pid (run-container container-directory
mounts namespaces 1 mounts namespaces 1