From: Patrik Flykt Date: Fri, 7 Sep 2012 11:55:10 +0000 (+0300) Subject: tethering: Reset the tethering refcount on error X-Git-Tag: 1.7~28 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ab9cc2faadf73cb7ace797af5529b9841c6d3adc;p=platform%2Fupstream%2Fconnman.git tethering: Reset the tethering refcount on error Decrease the refcount with one on error. --- diff --git a/src/tethering.c b/src/tethering.c index e3432371..f3d67dfa 100644 --- a/src/tethering.c +++ b/src/tethering.c @@ -198,8 +198,10 @@ void __connman_tethering_set_enabled(void) return; err = __connman_bridge_create(BRIDGE_NAME); - if (err < 0) + if (err < 0) { + __sync_fetch_and_sub(&tethering_enabled, 1); return; + } index = connman_inet_ifindex(BRIDGE_NAME); dhcp_ippool = __connman_ippool_create(index, 2, 252, @@ -207,6 +209,7 @@ void __connman_tethering_set_enabled(void) if (dhcp_ippool == NULL) { connman_error("Fail to create IP pool"); __connman_bridge_remove(BRIDGE_NAME); + __sync_fetch_and_sub(&tethering_enabled, 1); return; } @@ -220,6 +223,7 @@ void __connman_tethering_set_enabled(void) if (err < 0 && err != -EALREADY) { __connman_ippool_unref(dhcp_ippool); __connman_bridge_remove(BRIDGE_NAME); + __sync_fetch_and_sub(&tethering_enabled, 1); return; } @@ -238,6 +242,7 @@ void __connman_tethering_set_enabled(void) __connman_bridge_disable(BRIDGE_NAME); __connman_ippool_unref(dhcp_ippool); __connman_bridge_remove(BRIDGE_NAME); + __sync_fetch_and_sub(&tethering_enabled, 1); return; }