Fix /etc/rc.d/random umask handling (/entropy permissions)

Jilles Tjoelker jilles at stack.nl
Mon Jan 23 22:11:00 UTC 2017


On Mon, Jan 23, 2017 at 10:52:21AM -0800, Simon J. Gerraty wrote:
> Jilles Tjoelker <jilles at stack.nl> wrote:
> > Index: etc/rc.d/random
> > ===================================================================
> > --- etc/rc.d/random	(revision 311446)
> > +++ etc/rc.d/random	(working copy)
> > @@ -20,12 +20,14 @@
> >  
> >  save_dev_random()
> >  {
> > +	oumask=`umask`

> why not simply use a sub-shell to tighten umask

> (umask 077; what-ever)

With our /bin/sh, the save-restore method saves a fork. A command
substitution with a single umask command does not fork, while a subshell
containing umask and something else does.

The effect is fairly minor, but good performance is often the product of
many small optimizations.

-- 
Jilles Tjoelker


More information about the freebsd-current mailing list