diff options
| author | Warner Losh <imp@FreeBSD.org> | 2025-09-28 11:58:31 -0600 |
|---|---|---|
| committer | Warner Losh <imp@FreeBSD.org> | 2025-09-28 19:45:01 -0600 |
| commit | b7473a5d68b8ade1ce6c6c08965fe284cc70bd75 (patch) | |
| tree | 67b967760920dadd12420a57087c996074c93256 /stand | |
| parent | 55025f42f6fa517aaffc902b3d69fc707536907d (diff) | |
loader: make disable-device more rebust
Check the number of arguments and ensure that the passed-in device to
disable parses correctly.
Sponsored by: Netflix
Diffstat (limited to 'stand')
| -rw-r--r-- | stand/lua/cli.lua | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/stand/lua/cli.lua b/stand/lua/cli.lua index 596e55a8d1d8..dda8c3da4c89 100644 --- a/stand/lua/cli.lua +++ b/stand/lua/cli.lua @@ -235,9 +235,17 @@ cli["disable-device"] = function(...) return end + if #argv > 1 then + print("Too many arguments") + print("usage error: disable-device device") + return + end + d, u = string.match(argv[1], "(%w*%a)(%d+)") - if d ~= nil then + if d ~= nil and u ~= nil then loader.setenv("hint." .. d .. "." .. u .. ".disabled", "1") + else + print("Cannot parse " .. argv[1] .." into driver and unit number.") end end |
