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=5c622406525196b027219e48a8811696b22febca;hb=a16654b12130d636b4e0f81839a26f5821619baa;hpb=6cc1ae506cd9368ea1848ec6ef748f904109727a diff --git a/modules/luci-mod-failsafe/luasrc/controller/failsafe/failsafe.lua b/modules/luci-mod-failsafe/luasrc/controller/failsafe/failsafe.lua index 5c6224065..60caadb4b 100644 --- a/modules/luci-mod-failsafe/luasrc/controller/failsafe/failsafe.lua +++ b/modules/luci-mod-failsafe/luasrc/controller/failsafe/failsafe.lua @@ -1,18 +1,7 @@ ---[[ -LuCI - Lua Configuration Interface - -Copyright 2008 Steven Barth -Copyright 2008-2011 Jo-Philipp Wich -Copyright 2012 Daniel Golle - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -$Id$ -]]-- +-- Copyright 2008 Steven Barth +-- Copyright 2008-2011 Jo-Philipp Wich +-- Copyright 2012 Daniel Golle +-- Licensed to the public under the Apache License 2.0. module("luci.controller.failsafe.failsafe", package.seeall) @@ -95,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 )