blob: 47a19859fffb4f07f1d66eeb4a2e74655276e478 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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;
}
|