diff --git a/src/etc/inc/config.inc b/src/etc/inc/config.inc index a6d292dbd..6bbdd5546 100644 --- a/src/etc/inc/config.inc +++ b/src/etc/inc/config.inc @@ -47,7 +47,7 @@ final class product { self::$data = json_decode(file_get_contents('/usr/local/opnsense/version/core'), true); - /* boot detection via exit_on_bootup() */ + /* boot detection */ $bootflag = '/var/run/booting'; @touch($bootflag); $fp = fopen($bootflag, 'r'); diff --git a/src/etc/inc/util.inc b/src/etc/inc/util.inc index 27e8fe895..7b9167b49 100644 --- a/src/etc/inc/util.inc +++ b/src/etc/inc/util.inc @@ -296,23 +296,11 @@ function unlock($cfglckkey = null) function exit_on_bootup($callback = null, $arguments = []) { - $bootflag = '/var/run/booting'; - - /* make sure file exists */ - @touch($bootflag); - - $fp = fopen($bootflag, 'r'); - if (!$fp) { - /* log possible error and adjust exist code */ - log_msg("exit_on_bootup(): error opening $bootflag", LOG_ERR); - exit(1); - } - - if (!flock($fp, LOCK_SH | LOCK_NB)) { + if (product::getInstance()->booting()) { if ($callback) { call_user_func_array($callback, $arguments); } - /* intentionally we exit here to avoid future cleverness WRT bootup handing */ + /* intentionally we exit here to avoid future cleverness WRT bootup handling */ exit(0); }