mirror of
https://github.com/lakinduakash/linux-wifi-hotspot.git
synced 2024-11-24 05:00:14 +00:00
Check if root before initializing lock in create_ap
If create_ap was executed without root it would initialize the /tmp/create_ap.all.lock with wrong ownership. This required the user to manually delete the lock before being able to run create_ap again.
This commit is contained in:
parent
bae89dae0f
commit
3b24457d26
@ -14,7 +14,7 @@
|
||||
# dnsmasq
|
||||
# iptables
|
||||
|
||||
VERSION=0.4.6
|
||||
VERSION=0.4.7
|
||||
PROGNAME="$(basename $0)"
|
||||
|
||||
# make sure that all command outputs are in english
|
||||
@ -1287,6 +1287,11 @@ fi
|
||||
|
||||
trap "cleanup_lock" EXIT
|
||||
|
||||
if [[ $(id -u) -ne 0 ]]; then
|
||||
echo "create_ap must be run as root." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! init_lock; then
|
||||
echo "ERROR: Failed to initialize lock" >&2
|
||||
exit 1
|
||||
@ -1311,11 +1316,6 @@ if [[ -n "$LIST_CLIENTS_ID" ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [[ $(id -u) -ne 0 ]]; then
|
||||
echo "create_ap must be run as root." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -n "$STOP_ID" ]]; then
|
||||
echo "Trying to kill $PROGNAME instance associated with $STOP_ID..."
|
||||
send_stop "$STOP_ID"
|
||||
|
Loading…
Reference in New Issue
Block a user