aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
Diffstat (limited to 'camel')
-rw-r--r--camel/ChangeLog6
-rw-r--r--camel/camel-mime-utils.c20
2 files changed, 21 insertions, 5 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index c4b0a513ab..dca89bc6a1 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,9 @@
+2001-04-15 Jeffrey Stedfast <fejj@ximian.com>
+
+ * camel-mime-utils.c (header_raw_check_mailing_list): regex
+ doesn't set errno and regcomp returns 0 on success and any other
+ value for an error (so don't *just* check for -1).
+
2001-04-14 Jeffrey Stedfast <fejj@ximian.com>
* camel-cipher-context.c: Check to make sure the context is a
diff --git a/camel/camel-mime-utils.c b/camel/camel-mime-utils.c
index ed6589819f..1d873007f6 100644
--- a/camel/camel-mime-utils.c
+++ b/camel/camel-mime-utils.c
@@ -3056,11 +3056,21 @@ header_raw_check_mailing_list(struct _header_raw **list)
const char *v;
regex_t pattern;
regmatch_t match[2];
- int i;
-
- for (i=0;i<sizeof(mail_list_magic)/sizeof(mail_list_magic[0]);i++) {
- if (regcomp(&pattern, mail_list_magic[i].pattern, REG_EXTENDED|REG_ICASE) == -1) {
- g_warning("Internal error, compiling regex failed: %s: %s", mail_list_magic[i].pattern, strerror(errno));
+ int i, errcode;
+
+ for (i = 0; i < sizeof (mail_list_magic) / sizeof (mail_list_magic[0]); i++) {
+ if ((errcode = regcomp (&pattern, mail_list_magic[i].pattern, REG_EXTENDED|REG_ICASE)) != 0) {
+ char *errstr;
+ size_t len;
+
+ len = regerror (errcode, pattern, NULL, 0);
+ errstr = g_malloc0 (len + 1);
+ regerror (errcode, pattern, errstr, len);
+
+ g_warning ("Internal error, compiling regex failed: %s: %s",
+ mail_list_magic[i].pattern, errstr);
+ g_free (errstr);
+
continue;
}