[arch-projects] [netcfg] [PATCH] Exit from stop_wpa() if there's nothing to terminate.
intelfx100 at gmail.com
Wed Oct 3 15:33:15 EDT 2012
On Tuesday 02 October 2012 15:12:29 Dave Reisner wrote:
> On Tue, Oct 02, 2012 at 10:27:24PM +0400, Ivan Shapovalov wrote:
> > Check "$WPA_CONF_DIR/$INTERFACE" for existence; exit if it's absent
> > (that is, wpa_supplicant isn't running).
> > Just avoids an error message from wpa_cli.
> > Signed-off-by: Ivan Shapovalov <intelfx100 at gmail.com>
> > ---
> > src/8021x | 3 +++
> > 1 file changed, 3 insertions(+)
> > diff --git a/src/8021x b/src/8021x
> > index 608d683..bce4e8c 100644
> > --- a/src/8021x
> > +++ b/src/8021x
> > @@ -73,6 +73,9 @@ stop_wpa()
> > # we need this as long as wpa_cli has a different default than netcfg
> > [[ -z "$WPA_CTRL_DIR" && -z "$WPA_CONF" ]] &&
> > WPA_CTRL_DIR="/run/wpa_supplicant">
> > + # exit if wpa_supplicant is already terminated for this interface
> > + [ -e "$WPA_CTRL_DIR/$INTERFACE" ] || return
> It baffles me why people blatently disregard syntax. [ is not identical
> to [[ in bash.
[ is POSIX while [[ is bash (and it gives some extra functions).
I'm not using the extra functions of the latter here, so why need to use [[ ?
> > +
> > wpa_call "$INTERFACE" terminate > /dev/null
> > # wait up to one second for the pid file to be removed
More information about the arch-projects