diff options
author | Ekaitz Zárraga <ekaitz.zarraga@fon.com> | 2015-09-14 13:31:49 +0200 |
---|---|---|
committer | Ekaitz Zárraga <ekaitz.zarraga@fon.com> | 2015-09-14 14:05:02 +0200 |
commit | a16654b12130d636b4e0f81839a26f5821619baa (patch) | |
tree | 17bf172b558a82144632678da1d326dc7aa0facb | |
parent | 6e1a089b5c765f3ab8a2029fa22c7be7ca0cae83 (diff) |
modules/luci-mod-failsafe: Fix nil file descriptor error
Signed-off-by: Ekaitz Zárraga <ekaitz.zarraga@fon.com>
-rw-r--r-- | modules/luci-mod-failsafe/luasrc/controller/failsafe/failsafe.lua | 12 |
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 ) |