Bugs in NEWGROUPS command

Patrik Rådman <[email protected]>
Newsgroups gmane.network.sn
Message-ID <[email protected]>
Hi,

I noticed tin wasn't displaying added groups as new, so I dug around in
commands.c and fixed (I think) a couple of bugs. Harold, please take a look
at the patch below and apply it if it's OK...

Bug 1: The current year becomes 1900 + 200.
Bug 2: ctime is updated if you move the spool with "cp -a", need to check
       mtime to get the creation date.
       
  - Patrik
  


--- commands.c.orig	Wed Jan 26 04:20:17 2000
+++ commands.c	Wed Jan 26 04:47:00 2000
@@ -263,7 +263,6 @@
 {
   struct tm tm = {0,};
   time_t t;
-  int thiscentury;
   int difference = 0;
   struct tm * tmp;
 
@@ -272,12 +271,10 @@
 
   t = time(NULL);
   tmp = localtime(&t);
-  thiscentury = (tmp->tm_year / 100) * 100;
 
 #define DIG(c) (c-'0')
   tm.tm_year = DIG(*date)*10 + DIG(date[1]); date += 2;
-  if( tm.tm_year < 50 )tm.tm_year += (thiscentury + 100);
-  else tm.tm_year += thiscentury;
+  if( tm.tm_year < 50 )tm.tm_year += 100;
   tm.tm_mon = DIG(*date)*10 + DIG(date[1]); date += 2;
   tm.tm_mon -= 1;
   tm.tm_mday = DIG(*date)*10 + DIG(date[1]);
@@ -316,7 +313,7 @@
         formats(buf, sizeof(buf)-1, "%s/.created", group);
         if( -1 == stat(buf, &st) ){
           log("do_newsgroups:stat(%s/.created):%m", group); continue; }
-        if( st.st_ctime >= cutoff ){
+        if( st.st_mtime >= cutoff ){
           struct group g;
           if( -1 == group_info(group, &g) )continue;
           args_write(1, "%s %d %d y\r\n", group, g.first, g.last);


-- 
  Patrik Rådman  ·  patrik at iki dot fi  ·  http://www.iki.fi/patrik/
       "With sufficient thrust, pigs fly just fine."  -- RFC 1925
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.