adblock: bugfix
authorDirk Brenken <[email protected]>
Mon, 21 Dec 2015 13:35:03 +0000 (14:35 +0100)
committerDirk Brenken <[email protected]>
Mon, 21 Dec 2015 13:35:03 +0000 (14:35 +0100)
* fix cornercase during domain query removal

Signed-off-by: Dirk Brenken <[email protected]>
net/adblock/Makefile
net/adblock/files/adblock-helper.sh
net/adblock/files/adblock-update.sh

index db029039411da4c7c9294acb62d5f8ad16b1f8f5..60d01699fec8be5edb0f3767dcbd3ca8e2c18963 100644 (file)
@@ -7,7 +7,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=adblock
-PKG_VERSION:=0.40.1
+PKG_VERSION:=0.40.2
 PKG_RELEASE:=1
 PKG_LICENSE:=GPL-3.0+
 PKG_MAINTAINER:=Dirk Brenken <[email protected]>
index f13b9acceab8fb0f6bab3806d6b7af1db276b53c..554c962e38b83eb68941ca10759873455f472528 100644 (file)
@@ -536,6 +536,10 @@ f_deltemp()
 #
 f_remove()
 {
+    local query_pid
+    local query_date
+    local query_total
+    local query_blocked
     if [ "${query_ok}" = "true" ] && [ "${ntp_ok}" = "true" ]
     then
         query_date="$(date "+%Y%m%d")"
@@ -547,20 +551,23 @@ f_remove()
         fi
         if [ -s "${adb_querypid}" ] && [ ! -f "${adb_queryfile}.${query_date}" ]
         then
-            kill -9 "$(cat "${adb_querypid}")" >/dev/null 2>&1
+            query_pid="$(cat "${adb_querypid}" 2>/dev/null)"
+            > "${adb_querypid}"
+            kill -9 "${query_pid}" >/dev/null 2>&1
             rc=${?}
             if [ $((rc)) -eq 0 ]
             then
                 find "${adb_backupdir}" -maxdepth 1 -type f -mtime +"${adb_queryhistory}" -name "${query_name}.*" -exec rm -f "{}" \; 2>/dev/null
                 rc=${?}
-            fi
-            if [ $((rc)) -eq 0 ]
-            then
-                f_log "remove old domain query log background process (pid: $(cat "${adb_querypid}")) and do logfile housekeeping"
+                if [ $((rc)) -eq 0 ]
+                then
+                    f_log "remove old domain query background process (pid: ${query_pid}) and do logfile housekeeping"
+                else
+                    f_log "error during domain query logfile housekeeping" "${rc}"
+                fi
             else
-                f_log "error during domain query removal/housekeeping (pid: $(cat "${adb_querypid}"))" "${rc}"
+                f_log "error during domain query background process removal (pid: ${query_pid})" "${rc}"
             fi
-            > "${adb_querypid}"
         fi
         if [ ! -s "${adb_querypid}" ]
         then
@@ -569,9 +576,9 @@ f_remove()
             if [ $((rc)) -eq 0 ]
             then
                 sleep 1
-                f_log "new domain query log background process started (pid: $(cat "${adb_querypid}"))"
+                f_log "new domain query log background process started (pid: $(cat "${adb_querypid}" 2>/dev/null))"
             else
-                f_log "error during domain query start" "${rc}"
+                f_log "error during domain query background process start" "${rc}"
             fi
         fi
     fi
index 9435f6c8fa0a6cc38719cd396b832ce5c2aac3ea..a2ab78b57025cf66e7000bd8b8cebc332f092f0e 100755 (executable)
@@ -25,7 +25,7 @@
 
 # set script version
 #
-adb_version="0.40.1"
+adb_version="0.40.2"
 
 # get current pid, script directory and openwrt version
 #