aboutsummaryrefslogtreecommitdiffstats
path: root/lock.c
diff options
context:
space:
mode:
authorMatthias Andree <matthias.andree@gmx.de>2006-03-14 09:10:20 +0000
committerMatthias Andree <matthias.andree@gmx.de>2006-03-14 09:10:20 +0000
commit9dc0b8bd674f71f8ee422b037dc409f2dd4f9487 (patch)
tree32e04cf0045782e10fc3eecc8fa82101b3fb94ec /lock.c
parent20a0097f74bfdec16c17dd7d3eb5968f81ec90c1 (diff)
downloadfetchmail-9dc0b8bd674f71f8ee422b037dc409f2dd4f9487.tar.gz
fetchmail-9dc0b8bd674f71f8ee422b037dc409f2dd4f9487.tar.bz2
fetchmail-9dc0b8bd674f71f8ee422b037dc409f2dd4f9487.zip
merge Mirek's fetchmail-signed.patch
svn path=/branches/BRANCH_6-3/; revision=4734
Diffstat (limited to 'lock.c')
-rw-r--r--lock.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/lock.c b/lock.c
index 5d41c587..89f767da 100644
--- a/lock.c
+++ b/lock.c
@@ -118,12 +118,18 @@ void lock_or_die(void)
int e = 0;
if ((fd = open(lockfile, O_WRONLY|O_CREAT|O_EXCL, 0666)) != -1) {
+ ssize_t wr;
+
snprintf(tmpbuf, sizeof(tmpbuf), "%ld\n", (long)getpid());
- if (write(fd, tmpbuf, strlen(tmpbuf)) < strlen(tmpbuf)) e = 1;
+ wr = write(fd, tmpbuf, strlen(tmpbuf));
+ if (wr == -1 || (size_t)wr != strlen(tmpbuf))
+ e = 1;
if (run.poll_interval)
{
snprintf(tmpbuf, sizeof(tmpbuf), "%d\n", run.poll_interval);
- if (write(fd, tmpbuf, strlen(tmpbuf)) < strlen(tmpbuf)) e = 1;
+ wr = write(fd, tmpbuf, strlen(tmpbuf));
+ if (wr == -1 || (size_t)wr != strlen(tmpbuf))
+ e = 1;
}
if (fsync(fd)) e = 1;
if (close(fd)) e = 1;