gsmdial: shutdown ppp link if we have one
authorKristen Carlson Accardi <kristen@linux.intel.com>
Thu, 25 Mar 2010 04:41:55 +0000 (21:41 -0700)
committerMarcel Holtmann <marcel@holtmann.org>
Thu, 25 Mar 2010 13:50:17 +0000 (06:50 -0700)
If we have created a ppp link, shut it down when the signal handler
is called.

gatchat/gsmdial.c

index aee9eea..a18f486 100644 (file)
@@ -101,6 +101,8 @@ static gboolean signal_cb(GIOChannel *channel, GIOCondition cond, gpointer data)
        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);
@@ -285,7 +287,7 @@ static void connect_cb(gboolean ok, GAtResult *result, gpointer user_data)
        ppp = g_at_ppp_new(channel);
        if (!ppp) {
                g_print("Unable to create PPP object\n");
-               return;
+               exit(1);
        }
        g_at_ppp_set_credentials(ppp, option_username,
                                option_password);