summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorHannu Nyman <hannu.nyman@iki.fi>2015-09-17 11:43:05 +0300
committerHannu Nyman <hannu.nyman@iki.fi>2015-09-17 11:43:05 +0300
commit892dd7383afda984d7dc274e3d51683105397240 (patch)
tree5e0a88eb27421875712aaf8b6e343e29894e8a0e
parentc207016774d6dade6d3fbcbbc44ac30e08acc12e (diff)
parenta16654b12130d636b4e0f81839a26f5821619baa (diff)
Merge pull request #473 from ekaitz-zarraga/fix-luci-failsafe
modules/luci-mod-failsafe: Fix nil file descriptor error
-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 6f78643018..60caadb4b1 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
)