Milter smfi_stop()

Cause a controlled shutdown V8.13 and later

When an error occurs while running your Milter (such as a failure to write to a database, or the inability to allocate memory),[453] you would normally syslog(3) an error, and call exit(2) to quit. A more graceful way to quit your Milter is to use the smfi_stop() routine. It is called like this:

(void) smfi_stop();

The smfi_stop() routine always returns MI_SUCCESS, no matter what, so you may safely ignore its returned value. The smfi_stop() routine sets an internal, global flag that causes all threads to return (exit) when each has finished the current connection. The result is a return from your call to smfi_main() so that you can perform cleanup tasks before exiting, or warm-restart the Milter.

Note that smfi_stop() returns, whereas exit(3) does not. Be sure your code can handle that difference before replacing exit(3) with smfi_stop().

[453] * You should try to allocate several times with a sleep(3) between each, just in case the problem is transient.

Get sendmail, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.