]> the.earth.li Git - onak.git/blobdiff - onak-mail.pl.in
Fix compilation breakage introduced in last commit
[onak.git] / onak-mail.pl.in
index 5c1ce53f603b46fa0fb052881083f8cdd7e45630..097404e67b6a9df44761bfbb5ff1d15748ecb712 100644 (file)
@@ -2,8 +2,7 @@
 #
 # 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.
 #
 
@@ -38,8 +37,6 @@ sub readconfig {
                        $config{'mta'} = $1;
                } elsif (/^pks_bin_dir (.*)/) {
                        $config{'pks_bin_dir'} = $1;
-               } elsif (/^db_dir (.*)/) {
-                       $config{'db_dir'} = $1;
                } elsif (/^mail_dir (.*)/) {
                        $config{'mail_dir'} = $1;
                } elsif (/^syncsite (.*)/) {
@@ -213,17 +210,18 @@ my $tmpfile = sprintf "%s/%04d%02d%02d-%02d%02d%02d-%d.onak",
                        $time[1],
                        $time[0],
                        $$;
-open(MAILFILE, '>'.$tmpfile);
+open(MAILFILE, '>'.$tmpfile.'.tmp');
 while (<>) {
        print MAILFILE $_;
 }
 close(MAILFILE);
+rename $tmpfile.".tmp", $tmpfile;
 
 #
 # Lock here to ensure that only one copy of us is processing the incoming
 # mail queue at any point in time.
 #
-sysopen(LOCKFILE, $config{'db_dir'}.'/onak-mail.lck',
+sysopen(LOCKFILE, $config{'mail_dir'}.'/onak-mail.lck',
                O_WRONLY|O_CREAT|O_EXCL) or exit;
 print LOCKFILE "$$";
 close(LOCKFILE);
@@ -257,7 +255,7 @@ while ($file = readdir(MAILDIR)) {
                        push @body, $_;
                }
        }
-       if (! defined($replyto)) {
+       if ($replyto eq '') {
                $replyto = $from;
        }
        close(FILE);
@@ -266,4 +264,4 @@ while ($file = readdir(MAILDIR)) {
        processmail($subject, $from, $replyto, \%seenby, \@body);
 }
 closedir(MAILDIR);
-unlink $config{'db_dir'}.'/onak-mail.lck';
+unlink $config{'mail_dir'}.'/onak-mail.lck';