diff options
author | Matthias Andree <matthias.andree@gmx.de> | 2006-03-14 09:10:20 +0000 |
---|---|---|
committer | Matthias Andree <matthias.andree@gmx.de> | 2006-03-14 09:10:20 +0000 |
commit | 9dc0b8bd674f71f8ee422b037dc409f2dd4f9487 (patch) | |
tree | 32e04cf0045782e10fc3eecc8fa82101b3fb94ec /lock.c | |
parent | 20a0097f74bfdec16c17dd7d3eb5968f81ec90c1 (diff) | |
download | fetchmail-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.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -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; |