diff options
author | Denis Kenzior <denkenz@gmail.com> | 2010-04-27 17:20:10 -0500 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2010-04-28 17:27:34 -0500 |
commit | 9c3ae4746e13145dd0c75d08d56e3c3714cdfcf3 (patch) | |
tree | 1587e228fcce883ed04bc5528ae587ae4a7c2160 | |
parent | d87529840455529b54a65990662da7977ac1c9a6 (diff) | |
download | ofono-9c3ae4746e13145dd0c75d08d56e3c3714cdfcf3.tar.bz2 |
gsmdial: Get rid of g_at_chat_shutdown usage
-rw-r--r-- | gatchat/gsmdial.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/gatchat/gsmdial.c b/gatchat/gsmdial.c index 30cc5cc1..2f342f67 100644 --- a/gatchat/gsmdial.c +++ b/gatchat/gsmdial.c @@ -104,14 +104,15 @@ static gboolean signal_cb(GIOChannel *channel, GIOCondition cond, gpointer data) case SIGINT: case SIGTERM: if (terminated == 0) { - char buf[64]; - if (ppp) - g_at_ppp_shutdown(ppp); - g_timeout_add_seconds(10, quit_eventloop, NULL); - sprintf(buf, "AT+CFUN=%u", option_offmode); - g_at_chat_send(control, buf, none_prefix, - power_down, NULL, NULL); + + if (ppp == NULL) { + char buf[64]; + sprintf(buf, "AT+CFUN=%u", option_offmode); + g_at_chat_send(control, buf, none_prefix, + power_down, NULL, NULL); + } else + g_at_ppp_shutdown(ppp); } terminated++; @@ -259,7 +260,9 @@ static void connect_cb(gboolean ok, GAtResult *result, gpointer user_data) * from the modem and does not let PPP get it. */ g_at_chat_unref(control); + control = NULL; g_at_chat_unref(modem); + modem = NULL; /* open ppp */ ppp = g_at_ppp_new(channel); @@ -669,8 +672,12 @@ int main(int argc, char **argv) g_main_loop_unref(event_loop); out: - g_at_chat_unref(control); - g_at_chat_unref(modem); + if (ppp == NULL) { + g_at_chat_unref(control); + g_at_chat_unref(modem); + } else + g_at_ppp_unref(ppp); + g_free(option_apn); return 0; |