diff --git a/src/etc/inc/plugins.inc b/src/etc/inc/plugins.inc index 301f3049ca..672555ca79 100644 --- a/src/etc/inc/plugins.inc +++ b/src/etc/inc/plugins.inc @@ -262,6 +262,7 @@ function plugins_configure($hook, $verbose = false, $args = []) { $logargs = []; $glob = '*'; + $ret = 1; /* no hook executed */ array_unshift($args, $verbose); @@ -318,6 +319,7 @@ function plugins_configure($hook, $verbose = false, $args = []) $argf, implode(',', array_slice($logargs, 0, $argc)) ), LOG_DEBUG); + $ret = 0; try { call_user_func_array($argf, array_slice($args, 0, $argc)); } catch (\Error $e) { @@ -328,6 +330,8 @@ function plugins_configure($hook, $verbose = false, $args = []) } } } + + return $ret; } function plugins_run($hook, $args = []) diff --git a/src/sbin/pluginctl b/src/sbin/pluginctl index dfc5f1e2b6..7f48884a63 100755 --- a/src/sbin/pluginctl +++ b/src/sbin/pluginctl @@ -344,7 +344,11 @@ if (isset($opts['h'])) { /* second argument is hook */ $hook = array_shift($args); /* other arguments are passed as is */ - plugins_configure($hook, !isset($opts['q']), $args); + $ret_int = plugins_configure($hook, !isset($opts['q']), $args); + /* cannot taint $ret in this case */ + if ($ret_int && !isset($opts['q'])) { + echo "The configuration hook `$hook' is not known to the system." . PHP_EOL; + } } exit($ret);