summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd/runner.c
diff options
context:
space:
mode:
authorJacek Masiulaniec <jacekm@cvs.openbsd.org>2009-01-06 20:17:24 +0000
committerJacek Masiulaniec <jacekm@cvs.openbsd.org>2009-01-06 20:17:24 +0000
commit57beca5400c36e5f3003e1652339d8c4b45bf7b3 (patch)
treeb6b6a70cb108b1e0286a6ecb5b467a56324afe99 /usr.sbin/smtpd/runner.c
parent2c1947e29aa50541dced600f4de43d3acebca486 (diff)
make file update in queue_update_envelope atomic; ok gilles@
Diffstat (limited to 'usr.sbin/smtpd/runner.c')
-rw-r--r--usr.sbin/smtpd/runner.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/usr.sbin/smtpd/runner.c b/usr.sbin/smtpd/runner.c
index 2f5de6426f9..40d4efbd2fd 100644
--- a/usr.sbin/smtpd/runner.c
+++ b/usr.sbin/smtpd/runner.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: runner.c,v 1.19 2009/01/04 22:35:09 gilles Exp $ */
+/* $OpenBSD: runner.c,v 1.20 2009/01/06 20:17:23 jacekm Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -802,7 +802,16 @@ runner_purge_run(void)
strcmp(dp->d_name, "..") == 0) {
continue;
}
- runner_purge_message(dp->d_name);
+ if (strcmp(dp->d_name, "envelope.tmp") == 0) {
+ char path[MAXPATHLEN];
+
+ if (! bsnprintf(path, MAXPATHLEN, "%s/envelope.tmp",
+ PATH_PURGE))
+ fatalx("runner_purge_run: snprintf");
+ if (unlink(path) == -1)
+ fatal("runner_purge_run: unlink");
+ } else
+ runner_purge_message(dp->d_name);
}
closedir(dirp);