changeset 5268:a96dc3692fce draft

privsep: root and inet don't need arc4random Saves a fd or two.
author Roy Marples <roy@marples.name>
date Sun, 24 May 2020 14:38:06 +0000
parents 95976721c27d
children 13d407c45d58
files src/privsep.c
diffstat 1 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/privsep.c	Sun May 24 14:49:41 2020 +0100
+++ b/src/privsep.c	Sun May 24 14:38:06 2020 +0000
@@ -321,12 +321,6 @@
 
 	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 @@
 	}
 
 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;
 }