From 31ce3e5ae140ffd5a96f8b010d4a281dafb0d17e Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Tue, 24 Jan 2012 16:19:05 +0100 Subject: cli: fail if requesting 3GPP actions and modem is not 3GPP --- cli/mmcli-modem-3gpp.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'cli/mmcli-modem-3gpp.c') diff --git a/cli/mmcli-modem-3gpp.c b/cli/mmcli-modem-3gpp.c index 3fbb315b..ba0af5c3 100644 --- a/cli/mmcli-modem-3gpp.c +++ b/cli/mmcli-modem-3gpp.c @@ -122,6 +122,16 @@ context_free (Context *ctx) g_free (ctx); } +static void +ensure_modem_3gpp (void) +{ + if (ctx->modem_3gpp) + return; + + g_printerr ("error: modem has no 3GPP capabilities"); + exit (EXIT_FAILURE); +} + void mmcli_modem_3gpp_shutdown (void) { @@ -230,6 +240,8 @@ get_modem_ready (GObject *source, ctx->object = mmcli_get_modem_finish (result, &ctx->manager); ctx->modem_3gpp = mm_object_get_modem_3gpp (ctx->object); + ensure_modem_3gpp (); + /* Request to scan networks? */ if (scan_flag) { g_debug ("Asynchronously scanning for networks..."); @@ -283,6 +295,8 @@ mmcli_modem_3gpp_run_synchronous (GDBusConnection *connection) &ctx->manager); ctx->modem_3gpp = mm_object_get_modem_3gpp (ctx->object); + ensure_modem_3gpp (); + if (scan_flag) g_assert_not_reached (); -- cgit v1.2.3-70-g09d2