From 76fc2998a4c0bb2246b4d76f65795a7169c16705 Mon Sep 17 00:00:00 2001 From: oblique Date: Fri, 29 Nov 2013 23:26:53 +0200 Subject: [PATCH] Add trap for SIGINT --- create_ap | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/create_ap b/create_ap index dcc63f5..6166c9b 100755 --- a/create_ap +++ b/create_ap @@ -144,6 +144,9 @@ die() { exit 1 } +# if the user press ctrl+c then execute die() +trap "die" SIGINT + ARGS=$(getopt -o hc:w:g:dnm: -l "help","hidden" -n $(basename $0) -- "$@") [[ $? -ne 0 ]] && exit 1 eval set -- "$ARGS" @@ -373,6 +376,7 @@ fi # start access point echo "hostapd command-line interface: hostapd_cli -p $CONFDIR/hostapd_ctrl" +trap - SIGINT # reset trap hostapd $CONFDIR/hostapd.conf || die "Failed to run hostapd, maybe a program is interfering." cleanup