help-cfengine
[Top][All Lists]
Advanced

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

Cfengine under uclibc, bug with h_aliases.


From: Olivier Fauchon
Subject: Cfengine under uclibc, bug with h_aliases.
Date: Tue, 5 Jul 2005 11:04:19 +0200
User-agent: Mutt/1.5.9i

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]