summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2012-11-27 22:04:04 +0100
committerAleksander Morgado <aleksander@lanedo.com>2012-11-27 22:04:04 +0100
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 0ee81be3..2f745c0d 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,
116 GRegex *r; 116 GRegex *r;
117 GMatchInfo *match_info = NULL; 117 GMatchInfo *match_info = NULL;
118 gint srv_stat = 0; 118 gint srv_stat = 0;
119 GError *inner_error = NULL;
119 120
120 result = mm_base_modem_at_command_finish (MM_BASE_MODEM (self), res, error); 121 result = mm_base_modem_at_command_finish (MM_BASE_MODEM (self), res, error);
121 if (!result) 122 if (!result)
@@ -125,8 +126,19 @@ load_access_technologies_finish (MMIfaceModem *self,
125 r = g_regex_new ("\\^SYSINFO:\\s*(\\d?),(\\d?),(\\d?),(\\d?),(\\d?),(\\d?),(\\d?)$", G_REGEX_UNGREEDY, 0, NULL); 126 r = g_regex_new ("\\^SYSINFO:\\s*(\\d?),(\\d?),(\\d?),(\\d?),(\\d?),(\\d?),(\\d?)$", G_REGEX_UNGREEDY, 0, NULL);
126 g_assert (r != NULL); 127 g_assert (r != NULL);
127 128
128 if (!g_regex_match_full (r, result, strlen (result), 0, 0, &match_info, error)) { 129 if (!g_regex_match_full (r, result, strlen (result), 0, 0, &match_info, &inner_error)) {
129 g_prefix_error (error, "Could not parse ^SYSINFO results: "); 130 if (inner_error) {
131 g_propagate_error (error, inner_error);
132 g_prefix_error (error, "Could not parse ^SYSINFO results: ");
133 } else {
134 g_set_error_literal (error,
135 MM_CORE_ERROR,
136 MM_CORE_ERROR_FAILED,
137 "Couldn't match ^SYSINFO reply");
138 }
139
140 if (match_info)
141 g_match_info_unref (match_info);
130 g_regex_unref (r); 142 g_regex_unref (r);
131 return FALSE; 143 return FALSE;
132 } 144 }