diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2013-04-24 23:07:45 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2013-04-25 09:36:51 +0200 |
commit | 2e6ba7cd09287bb984a356cf2606c64f5a779cd4 (patch) | |
tree | ede93b2714b07c74d91298697be4e556e64962d4 | |
parent | 40dc35a65718050297b12c6e7c106866a44a3305 (diff) | |
download | ModemManager-2e6ba7cd09287bb984a356cf2606c64f5a779cd4.tar.gz |
huawei: ensure error is set when ^CPIN response parser doesn't match
-rw-r--r-- | plugins/huawei/mm-broadband-modem-huawei.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/plugins/huawei/mm-broadband-modem-huawei.c b/plugins/huawei/mm-broadband-modem-huawei.c index dbcc2a925..22be4c72a 100644 --- a/plugins/huawei/mm-broadband-modem-huawei.c +++ b/plugins/huawei/mm-broadband-modem-huawei.c @@ -283,6 +283,7 @@ load_unlock_retries_finish (MMIfaceModem *self, const gchar *result; GRegex *r; GMatchInfo *match_info = NULL; + GError *match_error = NULL; guint i; MMModemLock locks[4] = { MM_MODEM_LOCK_SIM_PUK, @@ -299,9 +300,15 @@ load_unlock_retries_finish (MMIfaceModem *self, 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 ^CPIN results: "); + if (!g_regex_match_full (r, result, strlen (result), 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, + "Could not parse ^CPIN results: Response didn't match (%s)", + result); g_regex_unref (r); return NULL; } |