> + 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.Message
RE: [milter-greylist] peering problems on sun 8
2007-03-08 by attila.bruncsak@itu.int
Attachments
- No local attachments were found for this message.