X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=modules%2Fluci-mod-failsafe%2Fluasrc%2Fcontroller%2Ffailsafe%2Ffailsafe.lua;h=60caadb4b1fc498163dbcb8325a28f3b619fc2a8;hp=13bc6e50925df47966ede75634daf0711fe2bbcf;hb=a16654b12130d636b4e0f81839a26f5821619baa;hpb=7a3493b1f7d75a3945279115324cf2ff4da26b7b diff --git a/modules/luci-mod-failsafe/luasrc/controller/failsafe/failsafe.lua b/modules/luci-mod-failsafe/luasrc/controller/failsafe/failsafe.lua index 13bc6e509..60caadb4b 100644 --- a/modules/luci-mod-failsafe/luasrc/controller/failsafe/failsafe.lua +++ b/modules/luci-mod-failsafe/luasrc/controller/failsafe/failsafe.lua @@ -1,5 +1,5 @@ -- Copyright 2008 Steven Barth --- Copyright 2008-2011 Jo-Philipp Wich +-- Copyright 2008-2011 Jo-Philipp Wich -- Copyright 2012 Daniel Golle -- Licensed to the public under the Apache License 2.0. @@ -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 )