controlchan testing

Russ Allbery rra at stanford.edu
Tue May 8 16:41:38 UTC 2001


Russ Allbery <rra at Stanford.EDU> writes:

> Looks like newgroup.pl is assuming that it can rename from $inn::tmpdir
> to the database directory, which probably isn't a good assumption.  (I
> keep the history file on a separate partition.)  My preference for a fix
> is probably to write the new newsgroups file into the same directory as
> the current one instead.  Unless there are objections, I can go do that.

This patch has been tested and fixes the problem for newgroup.pl.  There's
also a similar fix for rmgroup.pl.

cvs server: Diffing .
Index: newgroup.pl
===================================================================
RCS file: /dist1/cvs/isc/inn/inn/control/modules/newgroup.pl,v
retrieving revision 1.1
diff -u -r1.1 newgroup.pl
--- newgroup.pl	2001/05/06 02:54:54	1.1
+++ newgroup.pl	2001/05/08 16:40:58
@@ -104,7 +104,7 @@
 sub update_desc {
     my ($name, $desc) = @_;
     shlock("$inn::locks/LOCK.newsgroups");
-    my $tempfile = "$inn::tmpdir/newgroup.$$";
+    my $tempfile = "$inn::newsgroups.$$";
     open(NEWSGROUPS, $inn::newsgroups)
         or logdie("Cannot open $inn::newsgroups: $!");
     open(TEMPFILE, ">$tempfile") or logdie("Cannot open $tempfile: $!");
@@ -123,6 +123,8 @@
     if ($desc ne $olddesc) {
         rename($tempfile, $inn::newsgroups)
             or logdie("Cannot rename $tempfile: $!");
+    } else {
+        unlink($tempfile);
     }
     unlink("$inn::locks/LOCK.newsgroups", $tempfile);
 }
Index: rmgroup.pl
===================================================================
RCS file: /dist1/cvs/isc/inn/inn/control/modules/rmgroup.pl,v
retrieving revision 1.1
diff -u -r1.1 rmgroup.pl
--- rmgroup.pl	2001/05/06 02:54:54	1.1
+++ rmgroup.pl	2001/05/08 16:40:58
@@ -53,7 +53,7 @@
         shlock("$inn::locks/LOCK.newsgroups");
         open(NEWSGROUPS, $inn::newsgroups)
             or logdie("Cannot open $inn::newsgroups: $!");
-        my $tempfile = "$inn::tmpdir/rmgroup.$$";
+        my $tempfile = "$inn::newsgroups.$$";
         open(TEMPFILE, ">$tempfile") or logdie("Cannot open $tempfile: $!");
         while (<NEWSGROUPS>) {
             print TEMPFILE $_ if not /^\Q$groupname\E\s/;

-- 
Russ Allbery (rra at stanford.edu)             <http://www.eyrie.org/~eagle/>


More information about the inn-workers mailing list