aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS3
-rw-r--r--fetchmail.c13
2 files changed, 11 insertions, 5 deletions
diff --git a/NEWS b/NEWS
index 33602ff3..28d97a52 100644
--- a/NEWS
+++ b/NEWS
@@ -13,8 +13,9 @@ fetchmail-5.0.5 ():
* Added Spanish and German descriptions to spec (thanks to Horst von Brand).
* Moved MIME decoding earlier to avoid messing with header length after
offsets have been calculated.
+* Make the .fetchmail_pid lockfile with O_ECL. Duhh...
-There are 261 people on fetchmail-friends and 408 on fetchmail-announce.
+There are 258 people on fetchmail-friends and 412 on fetchmail-announce.
fetchmail-5.0.4 (Fri Jun 11 18:32:58 EDT 1999):
* Fixed compilation error on systems without vnsprintf.
diff --git a/fetchmail.c b/fetchmail.c
index d9ff9258..98428ff6 100644
--- a/fetchmail.c
+++ b/fetchmail.c
@@ -13,6 +13,7 @@
#if defined(HAVE_UNISTD_H)
#include <unistd.h>
#endif
+#include <fcntl.h>
#include <string.h>
#include <signal.h>
#if defined(HAVE_SYSLOG)
@@ -521,11 +522,15 @@ int main (int argc, char **argv)
signal(SIGQUIT, termhook);
/* here's the exclusion lock */
- if ((lockfp = fopen(lockfile,"w")) != NULL) {
- fprintf(lockfp,"%d",getpid());
+ if ((st = open(lockfile, O_WRONLY | O_CREAT | O_EXCL, 0666)) != -1) {
+ sprintf(tmpbuf,"%d", getpid());
+ write(st, tmpbuf, strlen(tmpbuf));
if (run.poll_interval)
- fprintf(lockfp," %d", run.poll_interval);
- fclose(lockfp);
+ {
+ sprintf(tmpbuf," %d", run.poll_interval);
+ write(st, tmpbuf, strlen(tmpbuf));
+ }
+ close(st);
#ifdef HAVE_ATEXIT
atexit(unlockit);