From d85c892c6ede75e29d33cb2b69e19da58720b110 Mon Sep 17 00:00:00 2001 From: Justin Maggard Date: Thu, 20 Sep 2012 16:12:36 -0700 Subject: [PATCH] client: Fix AutoConnect configuration Changing the AutoConnect setting via connmanctl does not work, due to the mistaken use of || instead of &&. This patch fixes the issue, and tries to make things a little more readable. --- client/commands.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/client/commands.c b/client/commands.c index 0caacd96..22d5b3c8 100644 --- a/client/commands.c +++ b/client/commands.c @@ -134,16 +134,20 @@ int config_switch(int argc, char *argv[], int c, DBusConnection *conn) switch (c) { case 'a': - if (*optarg != 'y' || *optarg != 'n' || *optarg != '1' || - *optarg != '0' || *optarg != 't' || - *optarg != 'f') - return -EINVAL; - if (*optarg == 'y' || *optarg == '1' || - *optarg == 't') + switch (*optarg) { + case 'y': + case '1': + case 't': val = TRUE; - else if (*optarg == 'n' || *optarg == '0' || - *optarg == 'f') + break; + case 'n': + case '0': + case 'f': val = FALSE; + break; + default: + return -EINVAL; + } error = set_service_property(conn, message, argv[1], "AutoConnect", NULL, &val, 0); -- 2.34.1