NOFTRUNCATE

Lack ftruncate(2) support Port, edit sendmail/conf.h

Beginning with V8.10, sendmail uses the ftruncate(2) system call to truncate NDBM-style aliases database files before rebuilding them. This avoids a potential race condition that could yield false results when one sendmail reads the database at the precise moment another sendmail starts to rebuild.

Also, when sendmail delivers mail directly to a file, an error can occur while writing that can leave the file in an inconsistent state. Beginning with V8.10, sendmail truncates the file to its original length if an error occurs while writing.

Another, less serious, race condition can exist when sendmail writes one of its Host Status files, as defined by the HostStatusDirectory option (HostStatusDirectory on page 1037). If ftruncate(2) is available, sendmail truncates each file before writing new information.

Finally, note that when a MILTER program rewrites the message body, sendmail must truncate the df file before writing the new text.

For all currently supported systems that lack ftruncate(2), this NOFTRUNCATE compile-time macro is correctly defined. You will need only to define it when porting sendmail to a completely new system.

If you are running a precompiled sendmail binary, you can use the -d0.10 debugging command-line switch (-d0.10 on page 543) to determine whether NOFTRUNCATE support is defined (if it appears in the list, it is defined). New ports should be reported to so that they can be folded ...

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.