summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
d393825)
There's a race condition between us starting to accept a new incoming
mail and taking the lock to start processing it; a second copy of
onak-mail may come in and start to process the incomplete mail we're
in the process of receiving. Receive to a tmp file and rename to .onak
after we've received everything.
Fixes Debian bug #650557. Thanks to Helmut Grohne <helmut@subdivi.de>
-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