diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2011-07-24 12:42:18 +0200 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2011-07-24 12:54:38 +0200 |
commit | f416abdc399fb7deceda2e1202659b0b3e9c9abd (patch) | |
tree | f786ddda74cae3afafef88454cfa08cbaadc5b05 /plugins/ifx.c | |
parent | c5cb5c192e0ce6b265b867428ecf7a3334913dbb (diff) | |
download | ofono-f416abdc399fb7deceda2e1202659b0b3e9c9abd.tar.gz |
ifx: Fix race condition when online/offline operation fails
Diffstat (limited to 'plugins/ifx.c')
-rw-r--r-- | plugins/ifx.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/plugins/ifx.c b/plugins/ifx.c index 37cd2bbd..f9cd2054 100644 --- a/plugins/ifx.c +++ b/plugins/ifx.c @@ -645,11 +645,10 @@ static void set_online_cb(gboolean ok, GAtResult *result, gpointer user_data) { struct cb_data *cbd = user_data; ofono_modem_online_cb_t cb = cbd->cb; + struct ofono_error error; - if (ok) - CALLBACK_WITH_SUCCESS(cb, cbd->data); - else - CALLBACK_WITH_FAILURE(cb, cbd->data); + decode_at_error(&error, g_at_result_final_response(result)); + cb(&error, cbd->data); } static void ifx_set_online(struct ofono_modem *modem, ofono_bool_t online, @@ -661,13 +660,13 @@ static void ifx_set_online(struct ofono_modem *modem, ofono_bool_t online, DBG("%p %s", modem, online ? "online" : "offline"); - if (g_at_chat_send(data->dlcs[AUX_DLC], command, NULL, + if (g_at_chat_send(data->dlcs[AUX_DLC], command, none_prefix, set_online_cb, cbd, g_free) > 0) return; - g_free(cbd); - CALLBACK_WITH_FAILURE(cb, cbd->data); + + g_free(cbd); } static void ifx_pre_sim(struct ofono_modem *modem) |