Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 8 Aug 2003 05:50:24 -0700 (PDT)
From:      Oznobihin Konstantin <bork@asterix.rsu.ru>
To:        freebsd-standards@FreeBSD.org
Subject:   Re: standards/55370: [patch] uuid_compare function (uuid(3)) incorrectly compares node fields.
Message-ID:  <200308081250.h78CoNEP035421@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR standards/55370; it has been noted by GNATS.

From: Oznobihin Konstantin <bork@asterix.rsu.ru>
To: FreeBSD-gnats-submit@FreeBSD.org
Cc:  
Subject: Re: standards/55370: [patch] uuid_compare function (uuid(3))
	incorrectly compares node fields.
Date: 08 Aug 2003 12:41:54 +0000

 >return (memcmp(a->node, b->node, _UUID_NODE_LEN));
 Sorry, this patch isn't sufficient, because memcmp returns the
 difference between the first two differing bytes. Here is complete
 patch:
 --- uuid_compare.patch_2 begins here ---
 --- uuid_compare.c      Fri Aug  8 16:18:26 2003
 +++ /usr/src/lib/libc/uuid/uuid_compare.c       Wed Oct 30 06:51:00 2002
 @@ -72,8 +72,5 @@
         res = (int)a->clock_seq_low - (int)b->clock_seq_low;
         if (res)
                 return ((res < 0) ? -1 : 1);
 -       res = memcmp(a->node, b->node, _UUID_NODE_LEN);
 -       if (res)
 -               return ((res < 0) ? -1 : 1);
 -       return res;
 +       return (memcmp(a->node, b->node, sizeof(uuid_t)));
 }
 --- uuid_compare.patch_2 ends here ---
 
 -- 
 Konstantin Oznobihin <bork@rsu.ru>
 System Programmer
 Computer Center of Rostov State University.
 
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200308081250.h78CoNEP035421>