svn commit: r329901 - head/stand/lua

Kyle Evans kevans at FreeBSD.org
Sat Feb 24 03:47:04 UTC 2018


Author: kevans
Date: Sat Feb 24 03:47:04 2018
New Revision: 329901
URL: https://svnweb.freebsd.org/changeset/base/329901

Log:
  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.

Modified:
  head/stand/lua/config.lua

Modified: head/stand/lua/config.lua
==============================================================================
--- head/stand/lua/config.lua	Sat Feb 24 03:45:50 2018	(r329900)
+++ head/stand/lua/config.lua	Sat Feb 24 03:47:04 2018	(r329901)
@@ -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


More information about the svn-src-head mailing list