lualoader: Add comment on trailing space, don't operate on nil

Functionally, the latter error wouldn't necessarily hurt anything. io.write
will just error out as it's not passed a valid file handle. Still, we can do
better than that.
This commit is contained in:
Kyle Evans 2018-02-24 03:47:04 +00:00
parent 483f0a33f3
commit d930cdc295
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=329901

View File

@ -141,8 +141,14 @@ local function check_nextboot()
end
local nfile = io.open(nextboot_file, 'w')
io.write(nfile, "nextboot_enable=\"NO\" ")
io.close(nfile)
if nfile ~= nil then
-- We're overwriting the first line of the file, so we need the
-- trailing space to account for the extra character taken up by
-- the string nextboot_enable="YES" -- our new end quotation
-- mark lands on the S.
io.write(nfile, "nextboot_enable=\"NO\" ")
io.close(nfile)
end
end
-- Module exports