summaryrefslogtreecommitdiff
path: root/client/commands.c
diff options
context:
space:
mode:
authorJustin Maggard <jmaggard10@gmail.com>2012-09-20 16:12:36 -0700
committerPatrik Flykt <patrik.flykt@linux.intel.com>2012-09-24 12:26:08 +0300
commitd85c892c6ede75e29d33cb2b69e19da58720b110 (patch)
tree56d578012a23d47d32f43e8eafe11162ebbf2764 /client/commands.c
parentbaca46719603974ed6849996c50a66f4ebeb5ff1 (diff)
downloadconnman-d85c892c6ede75e29d33cb2b69e19da58720b110.tar.gz
connman-d85c892c6ede75e29d33cb2b69e19da58720b110.tar.bz2
connman-d85c892c6ede75e29d33cb2b69e19da58720b110.zip
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.
Diffstat (limited to 'client/commands.c')
-rw-r--r--client/commands.c20
1 files 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);