[Mimedefang] file descriptor scope and embedded perl

David F. Skoll dfs at roaringpenguin.com
Mon Jul 5 21:18:45 EDT 2004


On Mon, 5 Jul 2004, Chris Masters wrote:

> Since upgrading to the latest MIMEDefang today I have
> bad file descriptor errors - I assume this is an
> embedded perl scope issue.

Possibly.

> 1) I do *not* use filer_initialise

You should probably use it.  Any files opened at global scope outside
any function are opened once upon initialization.  When a slave is
started, mimedefang-multiplexor calls fork(2) and essentially dup's
the file descriptors.  However, the multiplexor child process (the one
that's about to morph into a slave) then calls close(2) on all open
file descriptors.  Perl doesn't know about this---it thinks the file
descriptors are still open---so when you try to use them, you get
error messages.

> Can/Should I declare *slave* globals in
> filter_initialise?

Yes.  (And it's ...ize rather than ...ise, because I'm in North America
rather than the UK. :-))

Regards,

David.



More information about the MIMEDefang mailing list