diff options
author | marcel <marcel@FreeBSD.org> | 2003-08-08 19:03:37 +0000 |
---|---|---|
committer | marcel <marcel@FreeBSD.org> | 2003-08-08 19:03:37 +0000 |
commit | 29b3048430753f78fddabc00956704f63423402e (patch) | |
tree | 350ae23903e81e67833356b4334013056483218f /lib/libc/uuid | |
parent | ddbdd973e22fb705b0746aa2c73be1e5ce1cd3b0 (diff) | |
download | FreeBSD-src-29b3048430753f78fddabc00956704f63423402e.zip FreeBSD-src-29b3048430753f78fddabc00956704f63423402e.tar.gz |
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>
Diffstat (limited to 'lib/libc/uuid')
-rw-r--r-- | lib/libc/uuid/uuid_compare.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/libc/uuid/uuid_compare.c b/lib/libc/uuid/uuid_compare.c index 8b6d218..3ff0cdb 100644 --- a/lib/libc/uuid/uuid_compare.c +++ b/lib/libc/uuid/uuid_compare.c @@ -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); } |