From 4590b17dd2dea3552bdb542ec00c025fb6e68ae7 Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Wed, 9 Nov 2016 19:44:06 +0100 Subject: [PATCH] system: crash-reported delete race, also move deletion out of conditional --- src/etc/inc/system.inc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/etc/inc/system.inc b/src/etc/inc/system.inc index afbf57a02..2fa161dd6 100644 --- a/src/etc/inc/system.inc +++ b/src/etc/inc/system.inc @@ -480,10 +480,14 @@ function system_routing_configure($interface = '') $foundgwv6 = false; $fargw = false; + /* XXX eventually this file-based workaround must be removed */ + foreach (glob('/tmp/*_defaultgw{,v6}', GLOB_BRACE) as $to_delete) { + @unlink($to_delete); + } + /* tack on all the hard defined gateways as well */ if (isset($config['gateways']['gateway_item'])) { - array_map('unlink', glob('/tmp/*_defaultgw{,v6}', GLOB_BRACE)); - foreach ($config['gateways']['gateway_item'] as $gateway) { + foreach ($config['gateways']['gateway_item'] as $gateway) { if (isset($gateway['defaultgw'])) { if ($gateway['ipprotocol'] != "inet6" && (is_ipaddrv4($gateway['gateway']) || $gateway['gateway'] == "dynamic")) { if(strstr($gateway['gateway'], ":")) {