On 11/11/2015 10:17 AM, Daniel P. Berrange wrote:
> +/*
> + * Check cells for cell and copies UUID if found, otherwise generates a new one,
this is to preserve UUID in libvirt
> + */
> +static void setUUID(struct jailhouse_cell *cells, size_t count, struct
jailhouse_cell* cell) {
> + size_t i;
> + for (i = 0; i < count; i++) {
> + if (strncmp(cells[i].name, cell->name, NAMELENGTH+1))
> + continue;
Use STREQLEN() instead of strncmp - btw if you rnu 'make syntax-check' it
ought to have warned you about this.
Thanks a lot for your review, I'll implement your suggestions.
In my defense of the strncmp code: I spent some time to fix my code according to HACKING
and syntax-check and replaced a lot of strncmp/strcmps with STREQLEN/STREQ but
syntax-check doesn't seem to detect this one for some reason? Probably a bug in
syntax-check.
--
Christian Loehle