openwrt15.05增加failsafe模块,WEB登陆提示错误

最近在新的路由器上移植openwrt15.05,发现增加failsafe模块后,web登陆提示如下错误:

/usr/lib/lua/luci/dispatcher.lua:433: Failed to execute function dispatcher target for entry '/'.
The called action terminated with an exception:
/usr/lib/lua/luci/dispatcher.lua:433: Failed to execute function dispatcher target for entry '/failsafe'.
The called action terminated with an exception:
/usr/lib/lua/luci/dispatcher.lua:433: Failed to execute call dispatcher target for entry '/failsafe/flashops'.
The called action terminated with an exception:
/usr/lib/lua/luci/controller/failsafe/failsafe.lua:91: attempt to index upvalue 'fp' (a nil value)
stack traceback:
	[C]: in function 'assert'
	/usr/lib/lua/luci/dispatcher.lua:433: in function 'dispatch'
	/usr/lib/lua/luci/dispatcher.lua:168: in function </usr/lib/lua/luci/dispatcher.lua:167>

打开/usr/lib/lua/luci/controller/failsafe/failsafe.lua文件,发现

local fp
        luci.http.setfilehandler(
                function(meta, chunk, eof)
                        if not fp then
                                if meta and meta.name == "image" then
                                        fp = io.open(image_tmp, "w")
                                end
                        end
                        if chunk then
                                fp:write(chunk)
                        end
                        if eof then
                                ***fp:close()***
                        end
                end
        )

此处的fp:cloase()报错,于是将此处的判断条件修改成:
if eof and fp then
然后测试OK,为了彻底修改,打开openwrt-15.05/openwrt/package/feeds/luci/luci-mod-failsafe/luasrc/controller/failsafe,将该文件中的if eof then判断条件修改成if eof and fp then,即可。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值