Yahoo Groups archive

Milter-greylist

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

Message

Re: [milter-greylist] peering problems on sun 8

2007-03-08 by Oliver Fromme

attila.bruncsak@... wrote:
 > 
 > >     + When you're done with the file, do _not_ close()
 > >       or fclose() low_fd!  That would free the descriptor,
 > >       so it might get re-used by somethign else (e.g. for
 > >       a network socket), so you lose your low-numbered FD.
 > >       Instead, fflush() the FILE*, then open /dev/null
 > >       again and dup2 it back to your low_fd, so the file
 > >       is closed but you still have the FD:
 > >          error = fflush(myfile);
 > >          high_fd = open("/dev/null", O_RDWR);
 > >          error = dup2(high_fd, low_fd); /* close db file */
 > 
 > I think it is not going to clean-up sufficiently the data structures
 > used by stdio library. The FILE* is still a valid file pointer some
 > should clean-it up, (buffers, etc).

Right, I didn't thinmk about that.  However ...

 > http://lists.freebsd.org/pipermail/freebsd-bugs/2005-January/011028.html

That message contains a workaround.  If calls fclose() on
the FILE*, then immediately uses dup2() to re-allocate the
file descriptor low_fd.

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

"What is this talk of 'release'?  We do not make software 'releases'.
Our software 'escapes', leaving a bloody trail of designers and quality
assurance people in its wake."

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.