Re: [exim] Local scan file descriptor

Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: Philip Hazel
Ημερομηνία:  
Προς: Rob Butler
Υ/ο: exim-users
Αντικείμενο: Re: [exim] Local scan file descriptor
On Mon, 24 Oct 2005, Rob Butler wrote:

> In exim's online documentation for the local scan API
> section 41.2 it says:
>
> extern int local_scan(int fd, uschar **return_text);
>
> The arguments are as follows:
>
>     *fd is a file descriptor for the file that
> contains the body of the message (the -D file). The
> file is open for reading and writing, but updating it
> is not recommended. Warning: You must not close this
> file descriptor.

>
> Why is updating the file not recommended?


Because you have to update it in place. If the host or process dies,
you'll end up with a scrambled file. (Mind you, since the message has
not been completely received, perhaps that won't matter.)

Also, this just feels "dodgy".

> Will there be any problem if the file is updated?


Values such as $message_size and $message_linecount may be incorrect.

> It this possible? Is this the best way to accomplish
> my goal? If not could you suggest a better way to do
> it?


It would be more straightforward to pipe the incoming message to an
application that then generated a suitable reply.

Further more, with your approach you will be copying all the old message
header lines instead of making new ones (Date:, Message-ID: etc). This
just doesn't seem right.

-- 
Philip Hazel            University of Cambridge Computing Service,
ph10@???      Cambridge, England. Phone: +44 1223 334714.
Get the Exim 4 book:    http://www.uit.co.uk/exim-book