Closing database in exit handler

Stefan Bellon sbellon at sbellon.de
Sun Sep 11 09:36:58 CEST 2005


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, if a process crashes and had file handles open at that
time, they remain open and the user has to close them manually.

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?

For all but the hardest kind of crashes, this helps on RISC OS.

-- 
Stefan Bellon



More information about the bogofilter-dev mailing list