Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 24 Feb 2018 03:47:04 +0000 (UTC)
From:      Kyle Evans <kevans@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r329901 - head/stand/lua
Message-ID:  <201802240347.w1O3l4YV072692@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201802240347.w1O3l4YV072692>