When exiting, return 1, when D-Bus method call is in progress return
-EINPROGRESS. When exiting successfully return 0, when an error is
encountered return the error value.
---
 client/commands.c |   14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/client/commands.c b/client/commands.c
index 3847c0a..7bd2bbb 100644
--- a/client/commands.c
+++ b/client/commands.c
@@ -36,12 +36,14 @@
 #include "services.h"
 #include "technology.h"
 #include "data_manager.h"
-#include "interactive.h"
 
+#include "commands.h"
 #include "dbus_helpers.h"
 
 #define MANDATORY_ARGS 3
 
+static DBusConnection *connection;
+
 static char *ipv4[] = {
        "Method",
        "Address",
@@ -573,7 +575,7 @@ static int cmd_monitor(char *args[], int num, struct option 
*options)
 
 static int cmd_exit(char *args[], int num, struct option *options)
 {
-       return 0;
+       return 1;
 }
 
 static struct option service_options[] = {
@@ -692,21 +694,23 @@ static int cmd_help(char *args[], int num, struct option 
*options)
        return 0;
 }
 
-int commands(DBusConnection *connection, char *argv[], int argc)
+int commands(DBusConnection *dbus_conn, char *argv[], int argc)
 {
        int i, result;
 
+       connection = dbus_conn;
+
        for (i = 0; cmd_table[i].cmd != NULL; i++) {
                if (g_strcmp0(cmd_table[i].cmd, argv[0]) == 0 &&
                                cmd_table[i].func != NULL) {
                        result = cmd_table[i].func(argv, argc,
                                        cmd_table[i].options);
-                       if (result < 0)
+                       if (result < 0 && result != -EINPROGRESS)
                                printf("Error '%s': %s\n", argv[0],
                                                strerror(-result));
                        return result;
                }
        }
 
-       return -1;
+       return -EINVAL;
 }
-- 
1.7.10.4

_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman

Reply via email to