]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
BSD: Setup sysctls before redirecting stderr
authorRoy Marples <roy@marples.name>
Wed, 1 Jul 2020 10:46:01 +0000 (11:46 +0100)
committerRoy Marples <roy@marples.name>
Wed, 1 Jul 2020 10:46:01 +0000 (11:46 +0100)
Need to do this as early as.

src/dhcpcd.c

index 891f62f2dc93504e2338aa8042d57daadcf27696..2bed8e0448e577de21a944314fc98eff9b5cb7b5 100644 (file)
@@ -2262,6 +2262,12 @@ printpidfile:
        }
 #endif
 
+#if defined(BSD) && defined(INET6)
+       /* Disable the kernel RTADV sysctl as early as possible. */
+       if (ctx.options & DHCPCD_IPV6 && ctx.options & DHCPCD_IPV6RS)
+               if_disable_rtadv();
+#endif
+
        if (isatty(STDOUT_FILENO) &&
            freopen(_PATH_DEVNULL, "r", stdout) == NULL)
                logerr("%s: freopen stdout", __func__);
@@ -2278,12 +2284,6 @@ printpidfile:
                }
        }
 
-#if defined(BSD) && defined(INET6)
-       /* Disable the kernel RTADV sysctl as early as possible. */
-       if (ctx.options & DHCPCD_IPV6 && ctx.options & DHCPCD_IPV6RS)
-               if_disable_rtadv();
-#endif
-
        /* If we're not running in privsep, we need to create the DB
         * directory here. */
        if (!(ctx.options & DHCPCD_PRIVSEP)) {