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 attila.bruncsak@itu.int

>     + 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). On the other hand you cannot simply
fclose it even after some dup2() manipulation, since the internal 
file descriptor value in FILE* is still low_fd.
It looks like some function is missing which would do the task, something like
fdclose(). It should clean up all the stdio related resources, but do not close
the file descriptor at the end. It is the symmetric counterpart of the fdopen().
Did anybody thought about this before?
YES: http://lists.freebsd.org/pipermail/freebsd-bugs/2005-January/011028.html
I have the impression that without this function the problem cannot be solved cleanly/portably.

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.