From e97b155a36a9fe474dd3152e45e5dbfc57d1993b Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Tue, 13 Jan 2009 16:01:06 +0000 Subject: Modified fs.lua to survive nil parameters. Added create_directory and used within create_file and write_file. Reviewed each read_file call to make sure handles nil return value. git-svn-id: svn://svn.alpinelinux.org/acf/alpine-conf/trunk@1677 ab2d0c66-481e-0410-8bed-d214d4d58bed --- lbu-model.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lbu-model.lua') diff --git a/lbu-model.lua b/lbu-model.lua index 1b9cd79..f3cd3b6 100644 --- a/lbu-model.lua +++ b/lbu-model.lua @@ -180,7 +180,7 @@ end local was_mounted local mnt local function mount() - local configopts = format.parse_ini_file(fs.read_file(configfile), "") or {} + local configopts = format.parse_ini_file(fs.read_file(configfile) or "", "") or {} mnt = "/media/"..configopts.LBU_MEDIA local f = io.popen("grep "..mnt.." /proc/mounts") local cmdresult = f:read("*a") @@ -243,7 +243,7 @@ function getconfig (configcontents) if configcontents then configopts = format.parse_ini_file(configcontents, "") or {} elseif (fs.is_file(configfile)) then - configopts = format.parse_ini_file(fs.read_file(configfile), "") or {} + configopts = format.parse_ini_file(fs.read_file(configfile) or "", "") or {} end config["LBU_MEDIA"] = cfe({ value=configopts.LBU_MEDIA or "", @@ -457,7 +457,7 @@ function getpackage() local package = cfe({ type="raw", label="error", option="application/x-gzip" }) for name in fs.find(".*tar%.gz", tmp) do package.label = basename(name) - package.value = fs.read_file(name) + package.value = fs.read_file(name) or "" break end -- cgit v1.2.3