Yahoo Groups archive

Milter-greylist

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

Message

Re: [milter-greylist] milter-greylist 4.4 alpha1 is available

2012-02-28 by Oliver Fromme

manu@... wrote:
 > Oliver Fromme <olli@...> wrote:
 > 
 > > So, the most portable and easiest way is to use only fcntl()
 > > for locking on all platforms.  No #ifdef required.
 > 
 > And do you have a way to atomicaly open and lock?

No, but I don't think that is necessary anyway.

You only have to be careful if you want to use O_TRUNC at the
same time.  In this case, you must first open the file without
O_TRUNC, then acquire the lock with fcntl(), and if successful,
use ftruncate() on the descriptor.

If fcntl() was not successful, just close the file descriptor
again.  In this case the file won't be touched at all (not even
the mtime or ctime).

Best regards
   Oliver


-- 
Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing b. M.
Handelsregister: Registergericht Muenchen, HRA 74606,  Gesch\ufffdftsfuehrung:
secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht M\ufffdn-
chen, HRB 125758,  Gesch\ufffdftsf\ufffdhrer: Maik Bachmann, Olaf Erb, Ralf Gebhart

FreeBSD-Dienstleistungen, -Produkte und mehr:  http://www.secnetix.de/bsd

"We, the unwilling, led by the unknowing,
are doing the impossible for the ungrateful.
We have done so much, for so long, with so little,
we are now qualified to do anything with nothing."
\ufffd \ufffd \ufffd \ufffd -- Mother Teresa

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.