bug-cfengine
[Top][All Lists]
Advanced

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

Re: link.c: LinkFiles() fails to initialize some fields for copy=.


From: Sergio Gelato
Subject: Re: link.c: LinkFiles() fails to initialize some fields for copy=.
Date: Tue, 16 Apr 2002 18:22:30 +0200
User-agent: Mutt/1.2.5i

* Sergio Gelato [2002-04-16 13:56:43 +0200]:
> The following components of the struct image are accessed by CheckImage()
> (and/or its child ImageCopy()) but not initialised by LinkFiles():
> 
> linktype
> size

It turns out that several other fields also need to be defined. The list
includes at least "repository".

I ended up simply adding a
        bzero(&ip, sizeof(ip));
at the top of function LinkFiles(). This took care of my segmentation faults.
A proper struct Image constructor would of course be better (what about
platforms where a null pointer isn't all zeros?), but I don't understand the 
innards of cfengine well enough to get it right (yet).

Code documentation issues: I see that the "action" component of struct Image
is treated as (const char *), but the "server" component is initialized with
strdup("localhost") which only makes sense if the value may be edited in
place at some point. It would be nice to have some explicit "const" (or
at least "/* const */") qualifiers in there, to make the programmer's
intent clearer.



reply via email to

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