diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2013-04-24 23:12:12 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2013-04-25 09:36:51 +0200 |
commit | a32eef3434b169c8e58b285d8f30a3b206fc0dd7 (patch) | |
tree | c56846df4b9cbb721788678baeace4a07bf1b2b4 | |
parent | 77d096bdac59d6627785490aae71c9ddc9445807 (diff) | |
download | ModemManager-a32eef3434b169c8e58b285d8f30a3b206fc0dd7.tar.gz |
x22x: ensure error is set when +SYSSEL response parser doesn't match
-rw-r--r-- | plugins/x22x/mm-broadband-modem-x22x.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/plugins/x22x/mm-broadband-modem-x22x.c b/plugins/x22x/mm-broadband-modem-x22x.c index 76be9b7fc..2120b6d22 100644 --- a/plugins/x22x/mm-broadband-modem-x22x.c +++ b/plugins/x22x/mm-broadband-modem-x22x.c @@ -51,6 +51,7 @@ load_allowed_modes_finish (MMIfaceModem *self, const gchar *response; gchar *str; gint mode = -1; + GError *match_error = NULL; response = mm_base_modem_at_command_finish (MM_BASE_MODEM (self), res, error); if (!response) @@ -59,9 +60,16 @@ load_allowed_modes_finish (MMIfaceModem *self, r = g_regex_new ("\\+SYSSEL:\\s*(\\d+),(\\d+),(\\d+),(\\d+)", G_REGEX_UNGREEDY, 0, NULL); g_assert (r != NULL); - if (!g_regex_match_full (r, response, strlen (response), 0, 0, &match_info, error)) { - g_prefix_error (error, - "Failed to parse mode/tech response: "); + if (!g_regex_match_full (r, response, strlen (response), 0, 0, &match_info, &match_error)) { + if (match_error) { + g_propagate_error (error, match_error); + } else { + g_set_error (error, + MM_CORE_ERROR, + MM_CORE_ERROR_FAILED, + "Couldn't match +SYSSEL reply: %s", response); + } + g_regex_unref (r); return FALSE; } |