From 6c806d77dc541e360784a2f672e61b575ab1a9da Mon Sep 17 00:00:00 2001 From: Jan-Tarek Butt Date: Thu, 17 Aug 2017 09:12:37 +0200 Subject: [PATCH] gluon-geolocator: fix line endings and write mode --- .../luasrc/lib/gluon/geolocator/geolocator | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/package/gluon-geolocator/luasrc/lib/gluon/geolocator/geolocator b/package/gluon-geolocator/luasrc/lib/gluon/geolocator/geolocator index 63a3d134..b308fbfe 100755 --- a/package/gluon-geolocator/luasrc/lib/gluon/geolocator/geolocator +++ b/package/gluon-geolocator/luasrc/lib/gluon/geolocator/geolocator @@ -20,11 +20,11 @@ local function file_exsist(file) end if file_exsist(PID_PART) then - io.stdout:write("The geolocator is still running") + io.stdout:write("The geolocator is still running.\n") os.exit(0) else if io.open(PID_PART, "w") == nil then - io.stdout:write("Can`t create pid file on "..PID_PART) + io.stdout:write("Can`t create pid file on " .. PID_PART .. "\n") os.exit(1) end end @@ -51,7 +51,7 @@ local function Get_geolocation_info() -- Get list of BSSID there should ignored local blacklist_bssid = { } - for bl_bssid in ipairs(uci:get(GLC, "stettings", "blacklist")) do + for _, bl_bssid in ipairs(uci:get(GLC, "stettings", "blacklist")) do table.insert(blacklist_bssid,string.upper(bl_bssid)) end @@ -65,7 +65,7 @@ local function Get_geolocation_info() end end if #scaned_bssid < 12 then - io.stdout:write("No surrounded BSSIDs found.") + io.stdout:write("No surrounded BSSIDs found.\n") return { } end scaned_bssid = scaned_bssid:gsub("^,(.-),*", "%1") @@ -73,14 +73,14 @@ local function Get_geolocation_info() -- Request position local req = io.popen("curl --connect-timeout 15 -s http://openwifi.su/api/v1/bssids/" .. scaned_bssid) if not req then - io.stdout:write("connection failed.") + io.stdout:write("connection failed.\n") return { } end local jreq, _, err = json.parse(req:read("*a"), 1, nil) req:close() if err or jreq.lon == nil or jreq.lat == nil then - io.stdout:write("openwifi.su doesn't gif a location.") + io.stdout:write("openwifi.su doesn't gif a location.\n") return { } end @@ -104,11 +104,11 @@ if not uci:get(GLC, "stettings", "static_location") then uci:save(LOC) uci:commit(LOC) end -local timestap = io.open(TIME_STAMP, "a") +local timestap = io.open(TIME_STAMP, "w") if timestap ~= nil then timestap:write(os.time()) else - io.stdout:write("Can`t create pid file on "..TIME_STAMP) + io.stdout:write("Can`t create pid file on " .. TIME_STAMP .. "\n") exit(1) end timestap:close()