Re: [PATCH] ipconfig: Fix memory leak
On Thu, 2014-10-16 at 18:14 +0800, Chengyi Zhao wrote: From: Chengyi Zhao chengyi1.z...@archermind.com Applied, thanks! Patrik ___ connman mailing list connman@connman.net https://lists.connman.net/mailman/listinfo/connman
[PATCH] config: Handle IN_MOVED_TO inotify event
On some (weird) systems, /tmp might be on the same exact fs as /var, leading to a mv command raising IN_MOVED_FROM/IN_MOVE_TO inotify events and not IN_DELETE/IN_CREATE. --- src/config.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config.c b/src/config.c index 93a788a..e7d1671 100644 --- a/src/config.c +++ b/src/config.c @@ -891,7 +891,7 @@ static void config_notify_handler(struct inotify_event *event, return; } - if (event-mask IN_CREATE) + if (event-mask IN_CREATE || event-mask IN_MOVED_TO) create_config(ident); if (event-mask IN_MODIFY) { -- 1.8.5.5 ___ connman mailing list connman@connman.net https://lists.connman.net/mailman/listinfo/connman
[PATCH] Release references to technologies held by rfkill during cleanup.
--- src/connman.h| 1 + src/rfkill.c | 2 ++ src/technology.c | 15 +++ 3 files changed, 18 insertions(+) diff --git a/src/connman.h b/src/connman.h index da01215..bab013b 100644 --- a/src/connman.h +++ b/src/connman.h @@ -826,6 +826,7 @@ void __connman_service_save(struct connman_service *service); #include connman/notifier.h +void __connman_technology_cleanup_rfkill(void); int __connman_technology_init(void); void __connman_technology_cleanup(void); diff --git a/src/rfkill.c b/src/rfkill.c index 960cfea..2f073a9 100644 --- a/src/rfkill.c +++ b/src/rfkill.c @@ -232,4 +232,6 @@ void __connman_rfkill_cleanup(void) g_io_channel_unref(channel); channel = NULL; + + __connman_technology_cleanup_rfkill(); } diff --git a/src/technology.c b/src/technology.c index d80d9e6..5917c59 100644 --- a/src/technology.c +++ b/src/technology.c @@ -1776,6 +1776,21 @@ int __connman_technology_remove_rfkill(unsigned int index, return 0; } +gboolean find_first(gpointer key, gpointer value, gpointer user_data) +{ + return TRUE; +} + +void __connman_technology_cleanup_rfkill(void) +{ + struct connman_rfkill *rfkill; + + DBG(); + + while (rfkill = g_hash_table_find(rfkill_list, find_first, NULL)) + __connman_technology_remove_rfkill(rfkill-index, rfkill-type); +} + int __connman_technology_init(void) { DBG(); -- 1.9.1 ___ connman mailing list connman@connman.net https://lists.connman.net/mailman/listinfo/connman
Re: [PATCH] Release references to technologies held by rfkill during cleanup.
I have written a UI for connman an ran into an bug when restarting connman. When restarting, most technologies send the TechnologyRemoved signal via DBus. Bluetooth, however, never sent this signal, so when connman restarted I had two bluetooth technology entries in my UI. I traced it down to the fact that the rfkill_list in technology.c is static and never releases the technology by calling put_technology when cleaning up. So, this patch removes all rfkills in the list on cleanup so that all of the technologies are removed. ___ connman mailing list connman@connman.net https://lists.connman.net/mailman/listinfo/connman
[PATCH v2] config: Handle IN_MOVED_TO inotify event
If the user moves a .config to /var/lib/connman which happens to be on the same fs, this will raise IN_MOVED_FROM/IN_MOVE_TO inotify events and not IN_DELETE/IN_CREATE. --- src/config.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config.c b/src/config.c index 93a788a..e7d1671 100644 --- a/src/config.c +++ b/src/config.c @@ -891,7 +891,7 @@ static void config_notify_handler(struct inotify_event *event, return; } - if (event-mask IN_CREATE) + if (event-mask IN_CREATE || event-mask IN_MOVED_TO) create_config(ident); if (event-mask IN_MODIFY) { -- 1.8.5.5 ___ connman mailing list connman@connman.net https://lists.connman.net/mailman/listinfo/connman