summaryrefslogtreecommitdiffhomepage
path: root/modules
diff options
context:
space:
mode:
authorEkaitz Zárraga <ekaitz.zarraga@fon.com>2015-09-14 13:31:49 +0200
committerEkaitz Zárraga <ekaitz.zarraga@fon.com>2015-09-14 14:05:02 +0200
commita16654b12130d636b4e0f81839a26f5821619baa (patch)
tree17bf172b558a82144632678da1d326dc7aa0facb /modules
parent6e1a089b5c765f3ab8a2029fa22c7be7ca0cae83 (diff)
modules/luci-mod-failsafe: Fix nil file descriptor error
Signed-off-by: Ekaitz Zárraga <ekaitz.zarraga@fon.com>
Diffstat (limited to 'modules')
-rw-r--r--modules/luci-mod-failsafe/luasrc/controller/failsafe/failsafe.lua12
1 files changed, 7 insertions, 5 deletions
diff --git a/modules/luci-mod-failsafe/luasrc/controller/failsafe/failsafe.lua b/modules/luci-mod-failsafe/luasrc/controller/failsafe/failsafe.lua
index 6f7864301..60caadb4b 100644
--- a/modules/luci-mod-failsafe/luasrc/controller/failsafe/failsafe.lua
+++ b/modules/luci-mod-failsafe/luasrc/controller/failsafe/failsafe.lua
@@ -84,11 +84,13 @@ function action_flashops()
fp = io.open(image_tmp, "w")
end
end
- if chunk then
- fp:write(chunk)
- end
- if eof then
- fp:close()
+ if fp then
+ if chunk then
+ fp:write(chunk)
+ end
+ if eof then
+ fp:close()
+ end
end
end
)