Emmanuel Dreyfus wrote:
> Oliver Fromme wrote:
> > "The atexit() function shall register the function [...] to
> > be called [...] at normal program termination. At normal
> > program termination, all functions registered by the atexit()
> > function shall be called [...]. Normal termination occurs
> > either by a call to exit() or a return from main()."
>
> Which means that if you get a SIGSEGV, you loose.
Right, but you shouldn't get a SIGSEGV during normal
operation, because that would be a bug, wouldn't it. ;-)
And you _can_ install your own signal handler for SIGSEGV.
libmilter doesn't forbid that. It only ever touches the
signals SIGPIPE, SIGHUP, SIGTERM and SIGINT.
> > Since libmilter catches the signal and performs a controlled
> > shutdown, the process is terminated normally by return from
> > main(). Therefore the atexit() function should be executed.
> >
> > In fact, it should be sufficient to simply put the final
> > dump function after the call to smfi_main(), i.e. before
> > returning normally from main(). I don't think it is
> > necessary to use atexit() at all.
>
> I thought smfi_main() was never returning. Does it?
Yes it does, and it even returns a value: MI_SUCCESS or
MI_FAILURE (if the network initialization failed). Note
that, if it is stopped because of a signal, it still
returns MI_SUCCESS.
I.e. if your maqin() function ends like this, you should
be fine:
int result;
...
result = smfi_main();
final_dump();
if (result != MI_SUCCESS) {
/* Maybe log an error message here. */
return 1;
}
/* Maybe log successful termination here. */
return 0; /* success */
}
Best regards
Oliver
--
Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing b. M.
Handelsregister: Registergericht Muenchen, HRA 74606, Gesch\ufffdftsfuehrung:
secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht M\ufffdn-
chen, HRB 125758, Gesch\ufffdftsf\ufffdhrer: Maik Bachmann, Olaf Erb, Ralf Gebhart
Any opinions expressed in this message are personal to the author and may
not necessarily reflect the opinions of secnetix GmbH & Co KG in any way.
FreeBSD-Dienstleistungen, -Produkte und mehr: http://www.secnetix.de/bsd
"Unix gives you just enough rope to hang yourself --
and then a couple of more feet, just to be sure."
-- Eric AllmanMessage
Re: [milter-greylist] dbdump command
2007-02-23 by Oliver Fromme
Attachments
- No local attachments were found for this message.