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

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
This commit is contained in:
Nikos Mavrogiannopoulos 2014-09-01 01:09:39 +02:00
parent 45922bb086
commit 1a5a2dd446
1 changed files with 18 additions and 1 deletions

View File

@ -11,4 +11,21 @@ test -z "$1" && exit 1
pwfile=$1
shift
cat $pwfile|/usr/sbin/openconnect $*
pidfile=/var/run/ocwrap-$$.pid
cleanup()
{
if ! test -z "$pid";then
kill $pid
wait $pid
fi
exit 0
}
trap cleanup 1 2 3 6 15
rm -f "$pidfile"
/usr/sbin/openconnect $* <$pwfile &
pid=$!
wait $pid