INN commit: branches/2.5 (3 files)

INN Commit rra at isc.org
Mon Feb 8 20:54:29 UTC 2010


    Date: Monday, February 8, 2010 @ 12:54:29
  Author: iulius
Revision: 8961

Fixed a bug in how mailpost handles cross-posting feature.

Without this patch, mailpost does not detach from sendmail,
i.e. sendmail starts one mailpost after the other, instead
of running all mailposts for a new message in parallel.

Thanks to Harald Dunkel for the patch.

Modified:
  branches/2.5/CONTRIBUTORS
  branches/2.5/doc/pod/news.pod
  branches/2.5/frontends/mailpost.in

-----------------------+
 CONTRIBUTORS          |    2 +-
 doc/pod/news.pod      |    7 ++++++-
 frontends/mailpost.in |   19 +++++++++++++++++--
 3 files changed, 24 insertions(+), 4 deletions(-)

Modified: CONTRIBUTORS
===================================================================
--- CONTRIBUTORS	2010-02-08 20:54:10 UTC (rev 8960)
+++ CONTRIBUTORS	2010-02-08 20:54:29 UTC (rev 8961)
@@ -271,4 +271,4 @@
 David Hlacik, Andreas Mattheiss, James Ralston, Wim Lewis, Johan van Selst,
 Wolfgang M. Weyand, Berend Reitsma, William Kronert, Petr Novopashenniy,
 Steve Crook, John F. Morse, Tim Woodall, Jonathan Kamens, Kamil Jonca,
-S.P. Zeidler, Nix, Florian Schlichting, Torsten Jerzembeck
+S.P. Zeidler, Nix, Florian Schlichting, Torsten Jerzembeck, Harald Dunkel

Modified: doc/pod/news.pod
===================================================================
--- doc/pod/news.pod	2010-02-08 20:54:10 UTC (rev 8960)
+++ doc/pod/news.pod	2010-02-08 20:54:29 UTC (rev 8961)
@@ -276,6 +276,11 @@
 
 =item *
 
+Fixed a bug in how B<mailpost> handles cross-posting feature.  It was not
+properly detaching from B<sendmail>.  Thanks to Harald Dunkel for the patch.
+
+=item *
+
 B<batcher> has not supported the retrieval of an article with its
 file name for a long time.  The B<-S> flag is therefore removed.
 
@@ -1347,7 +1352,7 @@
 
 C<configure> now looks for B<sendmail> only in F</usr/sbin> and F</usr/lib>, not on
 the user's path.  This should reduce the need for B<--with-sendmail> if your
-preferred sendmail is in a standard location.
+preferred B<sendmail> is in a standard location.
 
 =item *
 

Modified: frontends/mailpost.in
===================================================================
--- frontends/mailpost.in	2010-02-08 20:54:10 UTC (rev 8960)
+++ frontends/mailpost.in	2010-02-08 20:54:29 UTC (rev 8961)
@@ -17,6 +17,7 @@
 use Getopt::Std;
 use IPC::Open3;
 use IO::Select;
+use POSIX qw(setsid);
 use strict;
 
 my $debugging = 0 ;
@@ -382,6 +383,7 @@
 if (defined $DATABASE{$message_id}) {
 
   if (!$opt_c) {
+    syslog("err", "Duplicate article <$message_id>.") if $use_syslog;
     print STDERR "Duplicate article <$message_id>.\n" if -t STDERR;
     exit(1);
   }
@@ -404,11 +406,24 @@
 ## For crosspost.
 
 if ($opt_c) {
-  if (fork() != 0) {
+  my $pid = fork();
+  if (!defined($pid)) {
     undef $tmpfile;  # Don't unlink $tmpfile.
     print STDERR "An error occurred during the fork.\n" if -t STDERR;
     exit(1);
   }
+  if ($pid != 0) { # Parent.
+    undef $tmpfile;  # Don't unlink $tmpfile.
+    exit(0);
+  }
+  close STDIN;
+  close STDOUT;
+  close STDERR;
+  setsid();
+  open (STDIN, "</dev/zero");
+  open (STDOUT, ">/dev/null");
+  open (STDERR, ">&STDOUT");
+
   sleep $opt_c ;
 
   open(LOCKFILE, "<$lockfile") || 
@@ -514,7 +529,7 @@
 	print SENDMAIL while <FILE> ;
 	close FILE ;
     } else {
-	print "No article left to send back.\n" ;
+	print STDERR "No article left to send back.\n" if -t STDERR;
     }
     close SENDMAIL ;
     




More information about the inn-committers mailing list