interfaces: fix an issue with a batch killbyname()

For 23.7 killbyname() should be removed.  PID files are here to stay.
This commit is contained in:
Franco Fichtner 2023-03-14 08:12:22 +01:00
parent 4292bd3500
commit a59f8666a2
2 changed files with 6 additions and 2 deletions

View File

@ -1,7 +1,7 @@
<?php
/*
* Copyright (C) 2015-2022 Franco Fichtner <franco@opnsense.org>
* Copyright (C) 2015-2023 Franco Fichtner <franco@opnsense.org>
* Copyright (C) 2004-2008 Scott Ullrich <sullrich@gmail.com>
* 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();

View File

@ -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);
}