summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/data_manager.c23
1 files changed, 7 insertions, 16 deletions
diff --git a/client/data_manager.c b/client/data_manager.c
index 96374eca..0c8e7e43 100644
--- a/client/data_manager.c
+++ b/client/data_manager.c
@@ -106,7 +106,6 @@ free_servers:
int connect_service(DBusConnection *connection, char *name)
{
DBusMessage *message, *message_connect = NULL;
- struct service_data service;
char *path = NULL;
const char *path_name;
DBusError err;
@@ -116,11 +115,7 @@ int connect_service(DBusConnection *connection, char *name)
if (message == NULL)
return -ENOMEM;
- path_name = find_service(connection, message, name, &service);
- if (path_name == NULL) {
- err_ret = -ENXIO;
- goto error;
- }
+ path_name = strip_service_path(name);
path = g_strdup_printf("/net/connman/service/%s", path_name);
message_connect = dbus_message_new_method_call("net.connman", path,
@@ -136,7 +131,8 @@ int connect_service(DBusConnection *connection, char *name)
-1, &err);
if (dbus_error_is_set(&err)) {
- printf("Connection failed; error: '%s'\n", err.message);
+ printf("Error '%s': %s\n", path, err.message);
+ dbus_error_free(&err);
err_ret = -EINVAL;
goto error;
}
@@ -157,7 +153,6 @@ error:
int disconnect_service(DBusConnection *connection, char *name)
{
DBusMessage *message, *message_disconnect = NULL;
- struct service_data service;
char *path = NULL;
const char *path_name;
DBusError err;
@@ -167,14 +162,9 @@ int disconnect_service(DBusConnection *connection, char *name)
if (message == NULL)
return -ENOMEM;
- path_name = find_service(connection, message, name, &service);
- if (path_name == NULL) {
- err_ret = -ENXIO;
- goto error;
- }
-
+ path_name = strip_service_path(name);
path = g_strdup_printf("/net/connman/service/%s", path_name);
- printf("%s\n", path);
+
message_disconnect = dbus_message_new_method_call("net.connman", path,
"net.connman.Service",
"Disconnect");
@@ -189,7 +179,8 @@ int disconnect_service(DBusConnection *connection, char *name)
-1, &err);
if (dbus_error_is_set(&err)) {
- printf("Connection failed; error: '%s'\n", err.message);
+ printf("Error '%s': %s\n", path, err.message);
+ dbus_error_free(&err);
err_ret = -EINVAL;
goto error;
}