summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2012-11-27 21:04:04 (GMT)
committerAleksander Morgado <aleksander@lanedo.com>2012-11-27 21:04:04 (GMT)
commitb0746c591f052587999ca22b81b86f1e8dd56354 (patch)
tree90fe3c105fc2ad692221585b492ff91966c52422
parent2f28193cd48a8d965ad9e26f1b918649ba10f5ec (diff)
huawei: don't assume g_regex_match_full() sets error when not matching
-rw-r--r--plugins/huawei/mm-broadband-modem-huawei.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/plugins/huawei/mm-broadband-modem-huawei.c b/plugins/huawei/mm-broadband-modem-huawei.c
index 0ee81be..2f745c0 100644
--- a/plugins/huawei/mm-broadband-modem-huawei.c
+++ b/plugins/huawei/mm-broadband-modem-huawei.c
@@ -116,6 +116,7 @@ load_access_technologies_finish (MMIfaceModem *self,
GRegex *r;
GMatchInfo *match_info = NULL;
gint srv_stat = 0;
+ GError *inner_error = NULL;
result = mm_base_modem_at_command_finish (MM_BASE_MODEM (self), res, error);
if (!result)
@@ -125,8 +126,19 @@ load_access_technologies_finish (MMIfaceModem *self,
r = g_regex_new ("\\^SYSINFO:\\s*(\\d?),(\\d?),(\\d?),(\\d?),(\\d?),(\\d?),(\\d?)$", G_REGEX_UNGREEDY, 0, NULL);
g_assert (r != NULL);
- if (!g_regex_match_full (r, result, strlen (result), 0, 0, &match_info, error)) {
- g_prefix_error (error, "Could not parse ^SYSINFO results: ");
+ if (!g_regex_match_full (r, result, strlen (result), 0, 0, &match_info, &inner_error)) {
+ if (inner_error) {
+ g_propagate_error (error, inner_error);
+ g_prefix_error (error, "Could not parse ^SYSINFO results: ");
+ } else {
+ g_set_error_literal (error,
+ MM_CORE_ERROR,
+ MM_CORE_ERROR_FAILED,
+ "Couldn't match ^SYSINFO reply");
+ }
+
+ if (match_info)
+ g_match_info_unref (match_info);
g_regex_unref (r);
return FALSE;
}