File: 06-unlinkd.dpatch

package info (click to toggle)
squid 2.6.5-6etch5
  • links: PTS
  • area: main
  • in suites: etch
  • size: 12,540 kB
  • ctags: 13,801
  • sloc: ansic: 105,278; sh: 6,083; makefile: 1,297; perl: 1,245; awk: 40
file content (72 lines) | stat: -rw-r--r-- 1,653 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#! /bin/sh -e
## 06-unlinkd.dpatch by Luigi Gangitano <luigi@debian.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Only run unlinkd for diskd and ufs storage methods

if [ $# -ne 1 ]; then
    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
    exit 1
fi
case "$1" in
    -patch) patch -f --no-backup-if-mismatch -p0 < $0;;
    -unpatch) patch -f --no-backup-if-mismatch -R -p0 < $0;;
    *)
	echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
	exit 1;;
esac

exit 0
--- src/main.c	2002-07-14 19:20:49.000000000 +0200
+++ src/main.c	2002-10-10 19:49:04.000000000 +0200
@@ -326,6 +326,21 @@
     asnFreeMemory();
 }
 
+#if USE_UNLINKD
+static int
+needUnlinkd(void)
+{
+    int i;
+    int r = 0;
+    for (i = 0; i < Config.cacheSwap.n_configured; i++) {
+	if (strcmp(Config.cacheSwap.swapDirs[i].type, "ufs") == 0 ||
+	strcmp(Config.cacheSwap.swapDirs[i].type, "diskd") == 0)
+	r++;
+    }
+    return r;
+}
+#endif
+
 static void
 mainReconfigure(void)
 {
@@ -350,6 +365,9 @@
 #endif
     redirectShutdown();
     authenticateShutdown();
+#if USE_UNLINKD
+    unlinkdClose();
+#endif
     externalAclShutdown();
     storeDirCloseSwapLogs();
     errorClean();
@@ -373,6 +391,9 @@
 #if USE_WCCP
     wccpInit();
 #endif
+#if USE_UNLINKD
+    if (needUnlinkd()) unlinkdInit();
+#endif
     serverConnectionsOpen();
     if (theOutIcpConnection >= 0) {
 	if (!Config2.Accel.on || Config.onoff.accel_with_proxy)
@@ -516,7 +537,7 @@
 
     if (!configured_once) {
 #if USE_UNLINKD
-	unlinkdInit();
+	if (needUnlinkd()) unlinkdInit();
 #endif
 	urlInitialize();
 	cachemgrInit();