INN commit: trunk/innd (ng.c)

INN Commit Russ_Allbery at isc.org
Thu Mar 5 19:10:33 UTC 2009


    Date: Thursday, March 5, 2009 @ 11:10:33
  Author: iulius
Revision: 8373

When a newsgroup is empty, the high water mark should be one less
than the low water mark according to RFC 3977.

"ctlinnd renumber" must not assume the previous high water mark
in the active file was right.

Modified:
  trunk/innd/ng.c

------+
 ng.c |   16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

Modified: ng.c
===================================================================
--- ng.c	2009-03-05 19:00:43 UTC (rev 8372)
+++ ng.c	2009-03-05 19:10:33 UTC (rev 8373)
@@ -329,7 +329,7 @@
 bool
 NGrenumber(NEWSGROUP *ngp)
 {
-    int			low, high, count,flag;
+    int			low, high, count, flag;
     char	        *f2;
     char		*f3;
     char		*f4;
@@ -355,20 +355,23 @@
 	    LogName, MaxLength(start, start));
 	return false;
     }
-    himark = atol(f2);
-    lomark = himark + 1;
-    /* note these will be the low and himarks if the group turns out to be empty. */
 
     /* Check overview data for the group. */
     if (!OVgroupstats(ngp->Name, &low, &high, &count, &flag)) return false;
     if (count != 0) {
-	/* non-empty group, so set low/himarks from overview. */
+	/* Non-empty group, so set low/high water marks from overview. */
 	lomark = low;
 	himark = high;
+    } else {
+        /* Empty group. */
+        himark = high;
+        lomark = himark + 1;
     }
     l = atol(f2);
     if (himark > l) {
 	syslog(L_NOTICE, RENUMBER, LogName, ngp->Name, "hi", l, himark);
+        /* f3 - f2 - 1 gives the length of the full high water mark
+         * in the active file. */
 	if (!FormatLong(f2, himark, f3 - f2 - 1)) {
 	    syslog(L_ERROR, NORENUMBER, LogName, ngp->Name, "hi");
 	    return false;
@@ -383,6 +386,9 @@
     if (lomark != l) {
 	if (lomark < l)
 	    syslog(L_NOTICE, RENUMBER, LogName, ngp->Name, "lo", l, lomark);
+        /* f4 - f3 gives the length of the full low water mark
+         * in the active file.
+         * f4 points at the space ' ' before the newsgroup flag. */
 	if (!FormatLong(f3, lomark, f4 - f3)) {
 	    syslog(L_ERROR, NORENUMBER, LogName, ngp->Name, "lo");
 	    return false;




More information about the inn-committers mailing list