shepherd: Ensure the log file has correct ownership.

* gnu/build/shepherd.scm (make-forkexec-constructor/container): Ensure
LOG-FILE has correct ownership.
master
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
1 changed files with 4 additions and 1 deletions

View File

@ -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