diff options
Diffstat (limited to 'maildrop/deliverdotlock.C')
| -rw-r--r-- | maildrop/deliverdotlock.C | 36 | 
1 files changed, 36 insertions, 0 deletions
| diff --git a/maildrop/deliverdotlock.C b/maildrop/deliverdotlock.C new file mode 100644 index 0000000..47a1985 --- /dev/null +++ b/maildrop/deliverdotlock.C @@ -0,0 +1,36 @@ +#include "config.h" +#include	"deliverdotlock.h" +#include	<stdlib.h> +#if	HAVE_UNISTD_H +#include	<unistd.h> +#endif + + +void DeliverDotLock::cleanup() +{ +	truncate(); +	DotLock::cleanup(); +} + +DeliverDotLock::DeliverDotLock() : truncate_fd(-1), truncate_size(0) +{ +	constructed(); +} + +DeliverDotLock::~DeliverDotLock() +{ +	destroying(); +} + +void DeliverDotLock::truncate() +{ +	if (truncate_fd >= 0 && +		ftruncate(truncate_fd, truncate_size) < 0) +	{ +		static const char msg[]="Unable to truncate mailbox.\n"; + +		if (write(2, msg, sizeof(msg)-1) < 0) +			; /* Ignore */ +	} +	truncate_fd= -1; +} | 
