I'm compiling cfengine with uclibc staticaly.
I found that uClibc has a different behaviour compared to standard C lib.
It seems that **h_aliases is NULL under uClibC if there are no aliases for the
host.
Whereas libc initialize an empty array when host don't have aliases.
So this line : for (i=0;hp->h_aliases[i]!=NULL;i++) (nameinfo:417) leads to a
segfault.
The patch bellow correct this behaviour, and avoid segfaults.
--- cfengine-2.1.15/src/nameinfo.c 2005-05-25 09:29:36.000000000 +0200
+++ cfengine-2.1.15-uclibc/src/nameinfo.c 2005-07-04 17:47:17.000000000
+0200
@@ -401,11 +414,14 @@
Debug("Adding hostname %s..\n",hp->h_name);
AddClassToHeap(CanonifyName(hp->h_name));
- for (i=0;hp->h_aliases[i]!=NULL;i++)
+ if (hp->h_aliases !=NULL)
+ {
+ for (i=0;hp->h_aliases[i]!=NULL;i++)
{
Debug("Adding alias %s..\n",hp->h_aliases[i]);
AddClassToHeap(CanonifyName(hp->h_aliases[i]));
}
+ }
}
}
Hope that helps
--
Olivier Fauchon
_______________________________________________
Help-cfengine mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-cfengine