The ./start.sh script spawns hostapd process using "sudo". Since sudo forks a child process, $! holds the pid of sudo itself. Fix that by storing the PID of the child process instead. Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@xxxxxxxxx> --- tests/hwsim/start.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/hwsim/start.sh b/tests/hwsim/start.sh index 527ee22..7682fce 100755 --- a/tests/hwsim/start.sh +++ b/tests/hwsim/start.sh @@ -121,7 +121,10 @@ sudo $(printf -- "$VALGRIND_WPAS" 5) $WPAS -g /tmp/wpas-wlan5 -G$GROUP \ -ddKt$TRACE -f $LOGDIR/log5 & sudo $VALGRIND_HAPD $HAPD -ddKt$TRACE -g /var/run/hostapd-global -G $GROUP -f $LOGDIR/hostapd & HPID=$! -echo $HPID > $LOGDIR/hostapd-test.pid + +# Sleep a bit, otherwise pgrep may run before the child is forked +sleep 0.1 +pgrep -P $HPID > $LOGDIR/hostapd-test.pid if [ -x $HLR_AUC_GW ]; then cp $DIR/auth_serv/hlr_auc_gw.milenage_db $LOGDIR/hlr_auc_gw.milenage_db -- 2.7.4 _______________________________________________ Hostap mailing list Hostap@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/hostap