Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Jan 2017 23:10:51 +0100
From:      Jilles Tjoelker <jilles@stack.nl>
To:        "Simon J. Gerraty" <sjg@juniper.net>
Cc:        Lu Tung-Pin <lutungpin@openmailbox.org>, freebsd-current@freebsd.org, des@freebsd.org
Subject:   Re: Fix /etc/rc.d/random umask handling (/entropy permissions)
Message-ID:  <20170123221050.GA77550@stack.nl>
In-Reply-To: <43886.1485197541@kaos.jnpr.net>
References:  <14f5a2fdf191c33e4ed1dc882b288e81@openmailbox.org> <20170121220136.GA59654@stack.nl> <43886.1485197541@kaos.jnpr.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Jan 23, 2017 at 10:52:21AM -0800, Simon J. Gerraty wrote:
> Jilles Tjoelker <jilles@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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20170123221050.GA77550>