Browse Source

openconnect: openconnect-wrapper would trap signals and send the correct one to server

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
Nikos Mavrogiannopoulos 10 years ago
parent
commit
fb536338aa
1 changed files with 18 additions and 1 deletions
  1. 18
    1
      net/openconnect/files/openconnect-wrapper

+ 18
- 1
net/openconnect/files/openconnect-wrapper View File

@@ -11,4 +11,21 @@ test -z "$1" && exit 1
11 11
 pwfile=$1
12 12
 shift
13 13
 
14
-cat $pwfile|/usr/sbin/openconnect $*
14
+pidfile=/var/run/ocwrap-$$.pid
15
+
16
+cleanup()
17
+{
18
+	if ! test -z "$pid";then
19
+		kill $pid
20
+		wait $pid
21
+	fi
22
+	exit 0
23
+}
24
+
25
+trap cleanup 1 2 3 6 15
26
+
27
+rm -f "$pidfile"
28
+/usr/sbin/openconnect $* <$pwfile &
29
+pid=$!
30
+
31
+wait $pid