diff options
author | Nathan Williams <njw@google.com> | 2011-11-30 17:33:39 -0500 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2011-12-02 13:06:44 -0600 |
commit | c1e64f1a33b8b877945e59bda58b1969cdc27614 (patch) | |
tree | dc8d1862390195e3d0a624ebbfab713ef2a365e7 | |
parent | 58b2a79f83269dfb57479c244c517c7fb6ff8ace (diff) |
gsm: improve scan response regex construction error handling
Change the error handling to be a bit more like what appears to have
been intended: if constructing the regex fails, report an error and
return. The existing code looked like it was set up to do this, but
wasn't quite wired together, and had process-terminating calls
(g_error()) followed by other code.
Change-Id: I4a7cee8fe01291976edc2e343fcbeb73e882f20b
-rw-r--r-- | src/mm-modem-helpers.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/mm-modem-helpers.c b/src/mm-modem-helpers.c index 25e0561d..b037d1dd 100644 --- a/src/mm-modem-helpers.c +++ b/src/mm-modem-helpers.c @@ -112,9 +112,9 @@ mm_gsm_parse_scan_response (const char *reply, GError **error) * +COPS: (2,"","T-Mobile","31026",0),(1,"AT&T","AT&T","310410"),0) */ - r = g_regex_new ("\\((\\d),([^,\\)]*),([^,\\)]*),([^,\\)]*)[\\)]?,(\\d)\\)", G_REGEX_UNGREEDY, 0, NULL); + r = g_regex_new ("\\((\\d),([^,\\)]*),([^,\\)]*),([^,\\)]*)[\\)]?,(\\d)\\)", G_REGEX_UNGREEDY, 0, &err); if (err) { - g_error ("Invalid regular expression: %s", err->message); + mm_err ("Invalid regular expression: %s", err->message); g_error_free (err); g_set_error_literal (error, MM_MODEM_ERROR, MM_MODEM_ERROR_GENERAL, @@ -141,9 +141,9 @@ mm_gsm_parse_scan_response (const char *reply, GError **error) * +COPS: (2,"T - Mobile",,"31026"),(1,"Einstein PCS",,"31064"),(1,"Cingular",,"31041"),,(0,1,3),(0,2) */ - r = g_regex_new ("\\((\\d),([^,\\)]*),([^,\\)]*),([^\\)]*)\\)", G_REGEX_UNGREEDY, 0, NULL); + r = g_regex_new ("\\((\\d),([^,\\)]*),([^,\\)]*),([^\\)]*)\\)", G_REGEX_UNGREEDY, 0, &err); if (err) { - g_error ("Invalid regular expression: %s", err->message); + mm_err ("Invalid regular expression: %s", err->message); g_error_free (err); g_set_error_literal (error, MM_MODEM_ERROR, MM_MODEM_ERROR_GENERAL, |