summaryrefslogtreecommitdiffstats
path: root/serial
diff options
context:
space:
mode:
Diffstat (limited to 'serial')
-rw-r--r--serial/manager.c6
-rw-r--r--serial/storage.c11
-rw-r--r--serial/storage.h1
3 files changed, 18 insertions, 0 deletions
diff --git a/serial/manager.c b/serial/manager.c
index 1c913351..eee5d1aa 100644
--- a/serial/manager.c
+++ b/serial/manager.c
@@ -1524,6 +1524,7 @@ static DBusHandlerResult list_proxies(DBusConnection *conn,
static DBusHandlerResult remove_proxy(DBusConnection *conn,
DBusMessage *msg, void *data)
{
+ struct proxy *prx = NULL;
const char *path;
GSList *l;
DBusError derr;
@@ -1541,6 +1542,11 @@ static DBusHandlerResult remove_proxy(DBusConnection *conn,
if (!l)
return err_does_not_exist(conn, msg, "Invalid proxy path");
+ /* Remove from storage */
+ if (dbus_connection_get_object_user_data(conn,
+ path, (void *) &prx) && prx)
+ proxy_delete(&prx->src, prx->tty);
+
g_free(l->data);
proxies_paths = g_slist_remove(proxies_paths, l->data);
diff --git a/serial/storage.c b/serial/storage.c
index f3c070d3..641ca1e8 100644
--- a/serial/storage.c
+++ b/serial/storage.c
@@ -87,6 +87,17 @@ int port_store(bdaddr_t *src, bdaddr_t *dst, int16_t id,
return err;
}
+int proxy_delete(bdaddr_t *src, const char *tty)
+{
+ char filename[PATH_MAX + 1], src_addr[18];
+
+ ba2str(src, src_addr);
+
+ create_name(filename, PATH_MAX, STORAGEDIR, src_addr, "proxy");
+
+ return textfile_del(filename, tty);
+}
+
int proxy_store(bdaddr_t *src, const char *uuid, const char *tty,
const char *name, uint8_t ch, int opts, struct termios *ti)
{
diff --git a/serial/storage.h b/serial/storage.h
index 300976b9..4a24bdf7 100644
--- a/serial/storage.h
+++ b/serial/storage.h
@@ -24,5 +24,6 @@
int port_delete(bdaddr_t *src, bdaddr_t *dst, int16_t id);
int port_store(bdaddr_t *src, bdaddr_t *dst, int16_t id,
uint8_t ch, const char *svcname);
+int proxy_delete(bdaddr_t *src, const char *tty);
int proxy_store(bdaddr_t *src, const char *uuid, const char *tty,
const char *name, uint8_t ch, int opts, struct termios *ti);