Yahoo Groups archive

Milter-greylist

Index last updated: 2026-04-28 23:32 UTC

Message

Re: [milter-greylist] Milter-greylist crashes on DragonFly-2.8

2011-01-30 by manu@netbsd.org

Here is a bug workaround attempt. The patch is against latest sources but I
tested it with success on latest 4.2.x.

I think it should be ifdef only for DragonflyBSD, but what label should I use?
#ifdef __DragonflyBSD__ ?

Index: conf.c
===================================================================
RCS file: /cvsroot/milter-greylist/conf.c,v
retrieving revision 1.69
diff -U 4 -r1.69 conf.c
--- conf.c      16 Jun 2010 01:30:30 -0000      1.69
+++ conf.c      30 Jan 2011 15:11:06 -0000
@@ -150,8 +150,9 @@
        FILE *stream;
        struct timeval tv1, tv2, tv3;
        struct conf_rec *currconf, *threadconf, *newconf;
 
+       WORKAROUND_BROKEN_PTHREAD_KEY();
        CONF_LOCK;
        currconf = TAILQ_FIRST(&conf_list_head);
        CONF_UNLOCK;
        assert(conf_cold ? (currconf == NULL) : (currconf != NULL));
Index: conf.h
===================================================================
RCS file: /cvsroot/milter-greylist/conf.h,v
retrieving revision 1.51
diff -U 4 -r1.51 conf.h
--- conf.h      9 Sep 2009 12:19:17 -0000       1.51
+++ conf.h      30 Jan 2011 15:11:06 -0000
@@ -150,8 +150,10 @@
 #define C_ALL          0x3
 
 extern struct conf_rec defconf;
 extern pthread_key_t conf_key;
+#define WORKAROUND_BROKEN_PTHREAD_KEY(dontcare) \
+    (void)pthread_setspecific(conf_key, NULL);
 #define GET_CONF() ((struct conf_rec *)pthread_getspecific(conf_key))
 #define conf (*GET_CONF())
 extern char *conffile;
 extern int conf_cold;
Index: dump.c
===================================================================
RCS file: /cvsroot/milter-greylist/dump.c,v
retrieving revision 1.41
diff -U 4 -r1.41 dump.c
--- dump.c      31 Oct 2009 21:28:03 -0000      1.41
+++ dump.c      30 Jan 2011 15:11:06 -0000
@@ -116,8 +116,9 @@
 {
        struct conf_rec *confp;
        struct timeval start;
 
+       WORKAROUND_BROKEN_PTHREAD_KEY();
        conf_retain();
        confp = GET_CONF();
        gettimeofday(&start, NULL);
        for (;;) {
Index: milter-greylist.c
===================================================================
RCS file: /cvsroot/milter-greylist/milter-greylist.c,v
retrieving revision 1.235
diff -U 4 -r1.235 milter-greylist.c
--- milter-greylist.c   12 Jul 2010 01:38:14 -0000      1.235
+++ milter-greylist.c   30 Jan 2011 15:11:06 -0000
@@ -174,8 +174,9 @@
        _SOCK_ADDR *addr;
 {
        sfsistat r;
 
+       WORKAROUND_BROKEN_PTHREAD_KEY();
        conf_retain();
        r = real_connect(ctx, hostname, addr);
        conf_release();
        return r;
Index: sync.c
===================================================================
RCS file: /cvsroot/milter-greylist/sync.c,v
retrieving revision 1.89
diff -U 4 -r1.89 sync.c
--- sync.c      16 Jun 2010 01:30:30 -0000      1.89
+++ sync.c      30 Jan 2011 15:11:06 -0000
@@ -760,8 +760,9 @@
        void *arg;
 {
        struct sync_master_sock *sms = arg;
 
+       WORKAROUND_BROKEN_PTHREAD_KEY();
        conf_retain();
        for (;;) {
                sockaddr_t raddr;
                socklen_t raddrlen;
@@ -1030,8 +1031,9 @@
        socklen_t addrlen;
        time_t date;
        time_t aw;
        
+       WORKAROUND_BROKEN_PTHREAD_KEY();
        conf_retain();
 
        aw = time(NULL) + conf.c_autowhite_validity;
        fprintf(stream, "200 Yeah, what do you want?\n");
@@ -1402,8 +1404,9 @@
 sync_sender_start(void) {
        pthread_t tid;
        int error;
 
+       WORKAROUND_BROKEN_PTHREAD_KEY();
        if ((error = pthread_create(&tid, NULL, 
            (void *(*)(void *))sync_sender, NULL)) != 0) {
                mg_log(LOG_ERR, "pthread_create failed: %s", strerror(error));
                exit(EX_OSERR);


-- 
Emmanuel Dreyfus
http://hcpnet.free.fr/pubz
manu@...

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.