aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-mime-utils.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-04-16 05:39:37 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-04-16 05:39:37 +0800
commitadc000f756fc9f0327b6564e178b638e60b8ad38 (patch)
tree3bed9e89e157db26298bb7c8c36f5f25575e2df0 /camel/camel-mime-utils.c
parent5c2d40573871067322a75dd1cf887303f115e15f (diff)
downloadgsoc2013-evolution-adc000f756fc9f0327b6564e178b638e60b8ad38.tar.gz
gsoc2013-evolution-adc000f756fc9f0327b6564e178b638e60b8ad38.tar.zst
gsoc2013-evolution-adc000f756fc9f0327b6564e178b638e60b8ad38.zip
regex doesn't set errno and regcomp returns 0 on success and any other
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). svn path=/trunk/; revision=9333
Diffstat (limited to 'camel/camel-mime-utils.c')
-rw-r--r--camel/camel-mime-utils.c20
1 files changed, 15 insertions, 5 deletions
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;
}