From cfc4a9930773ef2fa0651510c7c820efa3ddc347 Mon Sep 17 00:00:00 2001 From: Cyrus <lcb01@lcb01.de> Date: Sun, 20 Jul 2014 16:24:51 +0200 Subject: [PATCH] Fixed bug which led to empty ath9k crontab file The crontab file was opened in write mode but in the case where no monitor is defined it would leave an empty file. --- .../upgrade/ath9k-workaround/invariant/010-monitor | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/package/gluon-ath9k-workaround/files/lib/gluon/upgrade/ath9k-workaround/invariant/010-monitor b/package/gluon-ath9k-workaround/files/lib/gluon/upgrade/ath9k-workaround/invariant/010-monitor index ac6962477..908a14084 100755 --- a/package/gluon-ath9k-workaround/files/lib/gluon/upgrade/ath9k-workaround/invariant/010-monitor +++ b/package/gluon-ath9k-workaround/files/lib/gluon/upgrade/ath9k-workaround/invariant/010-monitor @@ -5,8 +5,10 @@ local uci = require 'luci.model.uci' local c = uci.cursor() -local f = io.open('/lib/gluon/cron/ath9k-workaround','w') -if f and site.monitor ~= nil then - f:write('* * * * * /usr/sbin/ath9k-workaround | nc ' .. site.monitor) - f:close() +if site.monitor ~= nil then + local f = io.open('/lib/gluon/cron/ath9k-workaround','w') + if f ~= nil then + f:write('* * * * * /usr/sbin/ath9k-workaround | nc ' .. site.monitor) + f:close() + end end -- GitLab