OpenAFS CVS Commit: openafs/src/viced by shadow

cvs@GRAND.CENTRAL.ORG cvs@GRAND.CENTRAL.ORG
Mon, 05 Aug 2002 17:11:57 EDT


Update of /cvs/openafs/src/viced
In directory GRAND.CENTRAL.ORG:/data/sb/openafs-prototypes-1.3/openafs/src/viced

Modified Files:
      Tag: openafs-prototypes-1_3_x
	host.c 
Log Message:
DELTA PROTO13-viced-malloc-dont-make-assumptions-about-the-compiler-20020524
AUTHOR shadow@dementia.org

based on report from lha@stacken.kth.se
"identP = (struct Identity *)malloc(1);

This can't be right, there should not be an assumption how the
c-compiler will lay out code. I find it acceptable to do something like this

           /* sizeof valid + offset of valid. */
           i.. = malloc(sizeof(identP->valid) + (int)&(((struct Identity *)0)->valid));

But then, why not just allocate a whole identP and be happy. A afsUUID
is not that bloted (16 bytes) so I can't see why way this is
chosen. 20 bytes will probably be allocated on 32 bit platforms for
the whole struct Identity."


--- DELTA config for openafs-prototypes-1_3_x follows ---
PROTO13-viced-malloc-dont-make-assumptions-about-the-compiler-20020524 openafs/src/viced/host.c 1.13.2.6 1.13.2.7