Fix two (2) bugs in one (1) statement:

o  fix the len argument of memcmp(3) to be the size of the node field
   of the uuid structure, not the size of the uuid structure itself.
   We're comparing the node fields...
o  uuid_compare(3) is specified to return -1, 0 or 1, depending on
   the outcome of the comparison. memcmp(3) returns the difference
   between the first differing bytes. Hence, we cannot ever return
   the return value of memcmp(3) as-is.

PR: standards/55370
Submitted by: Konstantin Oznobihin <bork@rsu.ru>
This commit is contained in:
Marcel Moolenaar 2003-08-08 19:03:37 +00:00
parent ebc9df0362
commit 3031a4311e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=118668

View File

@ -72,5 +72,8 @@ uuid_compare(uuid_t *a, uuid_t *b, uint32_t *status)
res = (int)a->clock_seq_low - (int)b->clock_seq_low;
if (res)
return ((res < 0) ? -1 : 1);
return (memcmp(a->node, b->node, sizeof(uuid_t)));
res = memcmp(a->node, b->node, sizeof(a->node));
if (res)
return ((res < 0) ? -1 : 1);
return (0);
}