Browse Source

adblock: bugfix

* fix cornercase during domain query removal

Signed-off-by: Dirk Brenken <dirk@brenken.org>
Dirk Brenken 9 years ago
parent
commit
bdb599ff28
3 changed files with 18 additions and 11 deletions
  1. 1
    1
      net/adblock/Makefile
  2. 16
    9
      net/adblock/files/adblock-helper.sh
  3. 1
    1
      net/adblock/files/adblock-update.sh

+ 1
- 1
net/adblock/Makefile View File

@@ -7,7 +7,7 @@
7 7
 include $(TOPDIR)/rules.mk
8 8
 
9 9
 PKG_NAME:=adblock
10
-PKG_VERSION:=0.40.1
10
+PKG_VERSION:=0.40.2
11 11
 PKG_RELEASE:=1
12 12
 PKG_LICENSE:=GPL-3.0+
13 13
 PKG_MAINTAINER:=Dirk Brenken <dirk@brenken.org>

+ 16
- 9
net/adblock/files/adblock-helper.sh View File

@@ -536,6 +536,10 @@ f_deltemp()
536 536
 #
537 537
 f_remove()
538 538
 {
539
+    local query_pid
540
+    local query_date
541
+    local query_total
542
+    local query_blocked
539 543
     if [ "${query_ok}" = "true" ] && [ "${ntp_ok}" = "true" ]
540 544
     then
541 545
         query_date="$(date "+%Y%m%d")"
@@ -547,20 +551,23 @@ f_remove()
547 551
         fi
548 552
         if [ -s "${adb_querypid}" ] && [ ! -f "${adb_queryfile}.${query_date}" ]
549 553
         then
550
-            kill -9 "$(cat "${adb_querypid}")" >/dev/null 2>&1
554
+            query_pid="$(cat "${adb_querypid}" 2>/dev/null)"
555
+            > "${adb_querypid}"
556
+            kill -9 "${query_pid}" >/dev/null 2>&1
551 557
             rc=${?}
552 558
             if [ $((rc)) -eq 0 ]
553 559
             then
554 560
                 find "${adb_backupdir}" -maxdepth 1 -type f -mtime +"${adb_queryhistory}" -name "${query_name}.*" -exec rm -f "{}" \; 2>/dev/null
555 561
                 rc=${?}
556
-            fi
557
-            if [ $((rc)) -eq 0 ]
558
-            then
559
-                f_log "remove old domain query log background process (pid: $(cat "${adb_querypid}")) and do logfile housekeeping"
562
+                if [ $((rc)) -eq 0 ]
563
+                then
564
+                    f_log "remove old domain query background process (pid: ${query_pid}) and do logfile housekeeping"
565
+                else
566
+                    f_log "error during domain query logfile housekeeping" "${rc}"
567
+                fi
560 568
             else
561
-                f_log "error during domain query removal/housekeeping (pid: $(cat "${adb_querypid}"))" "${rc}"
569
+                f_log "error during domain query background process removal (pid: ${query_pid})" "${rc}"
562 570
             fi
563
-            > "${adb_querypid}"
564 571
         fi
565 572
         if [ ! -s "${adb_querypid}" ]
566 573
         then
@@ -569,9 +576,9 @@ f_remove()
569 576
             if [ $((rc)) -eq 0 ]
570 577
             then
571 578
                 sleep 1
572
-                f_log "new domain query log background process started (pid: $(cat "${adb_querypid}"))"
579
+                f_log "new domain query log background process started (pid: $(cat "${adb_querypid}" 2>/dev/null))"
573 580
             else
574
-                f_log "error during domain query start" "${rc}"
581
+                f_log "error during domain query background process start" "${rc}"
575 582
             fi
576 583
         fi
577 584
     fi

+ 1
- 1
net/adblock/files/adblock-update.sh View File

@@ -25,7 +25,7 @@
25 25
 
26 26
 # set script version
27 27
 #
28
-adb_version="0.40.1"
28
+adb_version="0.40.2"
29 29
 
30 30
 # get current pid, script directory and openwrt version
31 31
 #