commit 76fc2998a4c0bb2246b4d76f65795a7169c16705
parent 4d7a9c372b5f8a26e9b7727f93ec00dfe1f91be6
Author: oblique <psyberbits@gmail.com>
Date: Fri, 29 Nov 2013 23:26:53 +0200
Add trap for SIGINT
Diffstat:
1 file changed, 4 insertions(+), 0 deletions(-)
diff --git 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