From: Roy Marples Date: Wed, 1 Jul 2020 10:46:01 +0000 (+0100) Subject: BSD: Setup sysctls before redirecting stderr X-Git-Tag: v9.1.3~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ac8805b6f96acd23557433ecefefed302cbd35b8;p=thirdparty%2Fdhcpcd.git BSD: Setup sysctls before redirecting stderr Need to do this as early as. --- diff --git a/src/dhcpcd.c b/src/dhcpcd.c index 891f62f2..2bed8e04 100644 --- a/src/dhcpcd.c +++ b/src/dhcpcd.c @@ -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)) {