From a59f8666a258babcbefd0ec0dc0d9dcb22952a0f Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Tue, 14 Mar 2023 08:12:22 +0100 Subject: [PATCH] interfaces: fix an issue with a batch killbyname() For 23.7 killbyname() should be removed. PID files are here to stay. --- src/etc/inc/interfaces.inc | 6 ++++-- src/etc/inc/util.inc | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/etc/inc/interfaces.inc b/src/etc/inc/interfaces.inc index ebb2d7fae..6bd2b821c 100644 --- a/src/etc/inc/interfaces.inc +++ b/src/etc/inc/interfaces.inc @@ -1,7 +1,7 @@ + * Copyright (C) 2015-2023 Franco Fichtner * Copyright (C) 2004-2008 Scott Ullrich * Copyright (C) 2008-2009 Ermal Luçi * Copyright (C) 2005 Espen Johansen @@ -1310,7 +1310,9 @@ function interface_proxyarp_configure($interface = '') /* kill any running choparp, on restart "all" */ if (empty($interface)) { - killbyname('choparp'); /* XXX only kills one */ + foreach (glob('/var/run/choparp_*.pid') as $pidfile) { + killbypid($pidfile); + } } $paa = array(); diff --git a/src/etc/inc/util.inc b/src/etc/inc/util.inc index 05f507f99..1bce582e5 100644 --- a/src/etc/inc/util.inc +++ b/src/etc/inc/util.inc @@ -32,8 +32,10 @@ require_once 'IPv6.inc'; +/* XXX only two callers left, better remove this unreliable function */ function killbyname($procname, $sig = 'TERM', $waitforit = true) { + /* pgrep -n only kills the newest matching process */ _killbypid(shell_safe('/bin/pgrep -anx %s', $procname), $sig, $waitforit); }