From: Roy Marples Date: Sun, 24 May 2020 14:38:06 +0000 (+0000) Subject: privsep: root and inet don't need arc4random X-Git-Tag: v9.1.0~19 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=113e3044b52efd8e9858513855e4df58b2733f05;p=thirdparty%2Fdhcpcd.git privsep: root and inet don't need arc4random Saves a fd or two. --- diff --git a/src/privsep.c b/src/privsep.c index 858525f7..8e8325bf 100644 --- a/src/privsep.c +++ b/src/privsep.c @@ -321,12 +321,6 @@ ps_start(struct dhcpcd_ctx *ctx) TAILQ_INIT(&ctx->ps_processes); -#ifdef ARC4RANDOM_H - /* Seed the random number generator early incase it needs /dev/urandom - * which won't be available in the chroot. */ - arc4random(); -#endif - switch (pid = ps_root_start(ctx)) { case -1: logerr("ps_root_start"); @@ -354,6 +348,13 @@ ps_start(struct dhcpcd_ctx *ctx) } started: + +#ifdef ARC4RANDOM_H + /* Seed the random number generator early incase it needs /dev/urandom + * which won't be available in the chroot. */ + arc4random(); +#endif + return 1; }