create_ap

create a nat-ed wifi ap
git clone git://git.2f30.org/create_ap
Log | Files | Refs | README | LICENSE

commit 92d35c0da301adc4aba05392959b66b729bc8c46
parent ee69810dc5efcf2305a07d3623c1f61044638fa8
Author: oblique <psyberbits@gmail.com>
Date:   Sun, 17 May 2015 18:44:04 +0300

Fix daemonize infinite loop

If `DAEMONIZE=1' is set in the config file then create_ap tries
to create daemon process all the time. This is done because we were
removing `--daemon' option from the parameters of the daemon process.
We fix this by using an environment variable instead.

Diffstat:
Mcreate_ap | 10++--------
1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/create_ap b/create_ap @@ -1065,16 +1065,10 @@ if [[ $FIX_UNMANAGED -eq 1 ]]; then exit 0 fi -if [[ $DAEMONIZE -eq 1 ]]; then - # remove --daemon - NEW_ARGS=( ) - for x in "${ARGS[@]}"; do - [[ "$x" != "--daemon" ]] && NEW_ARGS+=( "$x" ) - done +if [[ $DAEMONIZE -eq 1 && $RUNNING_AS_DAEMON -eq 0 ]]; then echo "Running as Daemon..." - # run a detached create_ap - setsid "$0" "${NEW_ARGS[@]}" & + RUNNING_AS_DAEMON=1 setsid "$0" "${ARGS[@]}" & exit 0 fi