services: urandom-seed: Set umask to 077 while shutting down.

* gnu/services/base.scm (urandom-seed-shepherd-service): Call 'umask'.
This commit is contained in:
Leo Famulari 2016-05-29 11:13:59 -04:00
parent df2dd07b88
commit 8fe5d95e66
No known key found for this signature in database
GPG key ID: 2646FA30BACA7F08

View file

@ -460,10 +460,12 @@ (define (urandom-seed-shepherd-service _)
(let ((buf (make-bytevector 512)))
(call-with-input-file "/dev/urandom"
(lambda (urandom)
(get-bytevector-n! urandom buf 0 512)
(call-with-output-file #$%random-seed-file
(lambda (seed)
(put-bytevector seed buf)))
(let ((previous-umask (umask #o077)))
(get-bytevector-n! urandom buf 0 512)
(call-with-output-file #$%random-seed-file
(lambda (seed)
(put-bytevector seed buf)))
(umask previous-umask))
#t)))))
(modules `((rnrs bytevectors)
(rnrs io ports)