Last year I submitted a patch to Courier which would allow filters to be
sorted in ascending order by their names.  This allows us to force the
sequence of filter invocations by giving them names like this:

  000-foo-filter
  010-bar-filter
  ... etc. ...

Well, this patch has been in Courier for quite a while now, but
unfortunately, Daniel Heule has recently pointed out that this doesn't
work properly.

I have now located and fixed a bug in this code.  It turns out that I was
incorrectly calling qsort().  I didn't initially notice the problem,
because the inodes of my filters were ordered in my own filter directory
such that readdir() followed by my incorrect qsort() call happened to
return them in alphabetical order by coincidence.

Anyway, I have now fixed this problem, and I'm enclosing the patch
below.  It goes against courier-0.54.1.

I'm sorry about any inconvenience this bug might have caused.  And
my sincere thanks to Daniel Heule.


--- courier/cdfilters.C.orig    2007-01-13 13:40:34.000000000 -0500
+++ courier/cdfilters.C 2007-01-13 14:02:01.000000000 -0500
@@ -35,4 +35,9 @@
 static int  nfilters      = 0;
 
+static int filter_cmp(const void* s0, const void* s1)
+{
+       return (strcmp(*((char **) s0), *((char **) s1)));
+}
+
 static void free_filters()
 {
@@ -117,5 +122,5 @@
                      (size_t) nfilters,
                      sizeof (char *),
-                     (int (*)(const void*, const void*)) strcmp);
+                     filter_cmp);
 
                for (int n = 0; n < nfilters; n++)
@@ -150,5 +155,5 @@
              (size_t) nfilters,
              sizeof (char *),
-             (int (*)(const void*, const void*)) strcmp);
+             filter_cmp);
 
        for (int n = 0; n < nfilters; n++)

-- 
 Lloyd Zusman
 [EMAIL PROTECTED]
 God bless you.


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
courier-users mailing list
[email protected]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users

Reply via email to