From a16654b12130d636b4e0f81839a26f5821619baa Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ekaitz=20Z=C3=A1rraga?= Date: Mon, 14 Sep 2015 13:31:49 +0200 Subject: [PATCH] modules/luci-mod-failsafe: Fix nil file descriptor error MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Ekaitz Zárraga --- .../luasrc/controller/failsafe/failsafe.lua | 12 +++++++----- 1 file 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 ) -- 2.25.1