diff options
author | Hannu Nyman <hannu.nyman@iki.fi> | 2015-09-17 11:43:05 +0300 |
---|---|---|
committer | Hannu Nyman <hannu.nyman@iki.fi> | 2015-09-17 11:43:05 +0300 |
commit | 892dd7383afda984d7dc274e3d51683105397240 (patch) | |
tree | 5e0a88eb27421875712aaf8b6e343e29894e8a0e /modules | |
parent | c207016774d6dade6d3fbcbbc44ac30e08acc12e (diff) | |
parent | a16654b12130d636b4e0f81839a26f5821619baa (diff) |
Merge pull request #473 from ekaitz-zarraga/fix-luci-failsafe
modules/luci-mod-failsafe: Fix nil file descriptor error
Diffstat (limited to 'modules')
-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 ) |