From 90d932e72176466041a298e807d8efe4c1c65c68 Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Tue, 28 Sep 2010 14:26:09 +0000 Subject: Proper fix for health storage to handle one or two-line entries. --- health-model.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'health-model.lua') diff --git a/health-model.lua b/health-model.lua index 16b4d2a..2749e2a 100644 --- a/health-model.lua +++ b/health-model.lua @@ -58,7 +58,15 @@ get_storage = function (self) local storage = {} local disk = diskfree() .. "\n" local other = {} - for line in string.gmatch(disk, "\n([^\n]*\n[^\n]*)") do + local lines = format.string_to_table(disk, "\n") + local i = 1 -- skip the first line + while i < #lines do + i = i+1 + line = lines[i] or "" + if lines[i+1] and string.match(lines[i+1], "^%s") then + i = i+1 + line = line .. "\n" .. lines[i] + end if string.match(line, "^/dev/fd%d+") then if not storage.floppy then storage.floppy = cfe({ type="group", value={}, label="Floppy drives" }) -- cgit v1.2.3