+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
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;
}