projects
/
onak.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Avoid race condition when receiving incoming mails
[onak.git]
/
onak-mail.pl.in
diff --git
a/onak-mail.pl.in
b/onak-mail.pl.in
index c635dfba601e5490352c2ac17f0c040e70e54979..96fce71008e10bf178d5e5d7ac67f34e80414b6e 100644
(file)
--- a/
onak-mail.pl.in
+++ b/
onak-mail.pl.in
@@
-2,8
+2,7
@@
#
# onak-mail.pl - Mail processing interface for onak, an OpenPGP Keyserver.
#
#
# onak-mail.pl - Mail processing interface for onak, an OpenPGP Keyserver.
#
-# Written by Jonathan McDowell <noodles@earth.li>
-# Copyright 2002-2005 Project Purple
+# Copyright 2002-2005 Jonathan McDowell <noodles@earth.li>
# Released under the GPL.
#
# Released under the GPL.
#
@@
-213,11
+212,12
@@
my $tmpfile = sprintf "%s/%04d%02d%02d-%02d%02d%02d-%d.onak",
$time[1],
$time[0],
$$;
$time[1],
$time[0],
$$;
-open(MAILFILE, '>'.$tmpfile);
+open(MAILFILE, '>'.$tmpfile
.'.tmp'
);
while (<>) {
print MAILFILE $_;
}
close(MAILFILE);
while (<>) {
print MAILFILE $_;
}
close(MAILFILE);
+rename $tmpfile.".tmp", $tmpfile;
#
# Lock here to ensure that only one copy of us is processing the incoming
#
# Lock here to ensure that only one copy of us is processing the incoming