[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [leafnode-list] No $(SYSCONFDIR)/local.groups on fresh install



Juergen Salk <juergen.salk@xxxxxx> writes:

> AFAICS, the problem occurs only if you have no local.groups file *and* 
> no preexisting groupinfo file, which is the case on a real fresh 
> installation.

I see.

Could you test this patch and let me know if it fixes the problem:

Index: activutil.c
===================================================================
RCS file: /var/CVS/leafnode-2/activutil.c,v
retrieving revision 1.43
diff -u -r1.43 activutil.c
--- activutil.c	13 Mar 2003 00:07:40 -0000	1.43
+++ activutil.c	2 Oct 2003 14:49:32 -0000
@@ -476,7 +476,7 @@
     static struct stat st1, st2;
     char *s1, *s2;
     char *t;
-    int reread = 0;
+    int reread = 0, stat2 = 0;
     const char *const append = "/local.groups";
 
     s1 = (char *)critmalloc(strlen(spooldir) + strlen(GROUPINFO) + 1,
@@ -496,23 +496,37 @@
 	reread = 1;
     }
     if (stat(s2, &st2)) {
+#if 0
 	ln_log(LNLOG_SERR, LNLOG_CTOP,
 	       "cannot stat %s: %m, may cause bad performance", s2);
 	reread = 1;
+#else
+	/* do nothing */
+    } else {
+	stat2 = 1;
+#endif
     }
 
-    if (reread || ((st1.st_mtime > activetime)
-		   || (st1.st_ino != activeinode))
-	|| ((st2.st_mtime > localmtime)
-	    || (st2.st_ino != localinode))) {
+
+    if (!reread && (st1.st_mtime > activetime
+		|| st1.st_ino != activeinode))
+	reread = 1;
+
+    if (!reread && stat2 && (st2.st_mtime > localmtime
+		|| st2.st_ino != localinode))
+	reread = 1;
+
+    if (reread) {
 	ln_log(LNLOG_SDEBUG, LNLOG_CTOP, "%sreading %s and %s",
 	       active ? "re" : "", s1, s2);
 	readactive();
 	readlocalgroups();
 	activetime = st1.st_mtime;
 	activeinode = st1.st_ino;
-	localmtime = st2.st_mtime;
-	localinode = st2.st_ino;
+	if (stat2) {
+	    localmtime = st2.st_mtime;
+	    localinode = st2.st_ino;
+	}
     }
     free(s2);
     free(s1);
@@ -529,7 +543,7 @@
 
     g = newa;
     while (g->name) {
-	if ( (ogrp = findgroup(g->name, old, oldactivesize)) != NULL ) {
+	if (old && (ogrp = findgroup(g->name, old, oldactivesize))) {
 	    g->first = (g->first > ogrp->first) ? ogrp->first : g->first;
 	    g->last = (g->last > ogrp->last) ? g->last : ogrp->last;
 	    g->age = (g->age > ogrp-> age) ? g->age : ogrp->age;

-- 
Matthias Andree

Encrypt your mail: my GnuPG key ID is 0x052E7D95

-- 
leafnode-list@xxxxxxxxxxxxxxxxxxxxxxxxxxxx -- mailing list for leafnode
To unsubscribe, send mail with "unsubscribe" in the subject to the list