Yahoo Groups archive

Milter-greylist

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

Message

Re: [milter-greylist] Milter Greylist's use of POSIX threads is seriously broken

2004-06-07 by Matthias Scheler

On Mon, Jun 07, 2004 at 10:39:07PM +0200, Emmanuel Dreyfus wrote:
> $ grep cond_wait *
> dump.c:                 if (pthread_cond_wait(&dump_sleepflag, &mutex) != 0)
> dump.c:                     syslog(LOG_ERR, "pthread_cond_wait failed: %s\n",

The error is one the line below:

                case 0:
                        if (pthread_cond_wait(&dump_sleepflag, &mutex) != 0)
                            syslog(LOG_ERR, "pthread_cond_wait failed: %s\n",
                                strerror(errno));
                                         ^^^^^

> So pthread_cond_wait retunrs != 0 and doesn't set errno. I removed the return
> value check in pthread_*_init for exactly the same reason. 

pthread_cond_wait() does *not* set "errno". Please check the manual page
under either Solaris or NetBSD. The error number is returned instead.
So the code should read:

                case 0: {
			int error;

			error = pthread_cond_wait(&dump_sleepflag, &mutex);
                        if (error != 0)
                            syslog(LOG_ERR, "pthread_cond_wait failed: %s\n",
                                strerror(error));
		}

Please check also for uninitialized condition variables because that's
what "libpthread" complained about in Milter Greylist 1.2.

	Kind regards

-- 
Matthias Scheler                                  http://scheler.de/~matthias/

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.