Closing database in exit handler

Matthias Andree matthias.andree at gmx.de
Sun Sep 11 18:14:54 CEST 2005


Stefan Bellon <sbellon at sbellon.de> writes:

> On RISC OS, file handles are not automatically closed by the operating
> system when a process dies (yes, this is annoying but cannot be
> changed).

So write a robust supervisor process that cleans up after the other
process.

> So, if a process crashes and had file handles open at that time, they
> remain open and the user has to close them manually.

Well, bogofilter assumes POSIX semantics. If we don't get them, tough luck.

> When Bogofilter crashes (rarely the case, but happens from time to
> time), it leaves wordlist.db open. I have no idea where in the code the
> exact places are, but those in the know, couldn't they just add
> something like
>
>    open_database();
>    atexit(close_database);
>
> i.e. register an exit handler when the database got opened?

This doesn't help if bogofilter crashes or is terminated by signal.

-- 
Matthias Andree



More information about the bogofilter-dev mailing list