]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
privsep: root and inet don't need arc4random
authorRoy Marples <roy@marples.name>
Sun, 24 May 2020 14:38:06 +0000 (14:38 +0000)
committerRoy Marples <roy@marples.name>
Sun, 24 May 2020 14:38:06 +0000 (14:38 +0000)
Saves a fd or two.

src/privsep.c

index 858525f7bab15baf9bbfefdebbf41b26927879ca..8e8325bf42f5d77efb04eceb1af20f5139bd0de4 100644 (file)
@@ -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;
 }