Changeset d55abe8b in mainline


Ignore:
Timestamp:
2019-02-10T20:46:17Z (5 years ago)
Author:
Matthieu Riolo <matthieu.riolo@…>
Children:
5f39027
Parents:
ed3d605
git-author:
Matthieu Riolo <matthieu.riolo@…> (2019-02-09 18:32:38)
git-committer:
Matthieu Riolo <matthieu.riolo@…> (2019-02-10 20:46:17)
Message:

correcting uuid_generate

When created an UUID randomly it could occur
that the returned UUID was not valid. This
commit ensures that the clock-portion always
starts with one of the following letter 89ab.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/uuid.c

    red3d605 rd55abe8b  
    6565
    6666        /* Version 4 UUID from random or pseudo-random numbers */
    67         uuid->b[8] = (uuid->b[8] & ~0xc0) | 0x40;
    68         uuid->b[6] = (uuid->b[6] & 0xf0) | 0x40;
     67        uuid->b[6] = (uuid->b[6] & 0x4F) | 0x40;
     68        uuid->b[8] = (uuid->b[8] & 0xBF) | 0xB0;
    6969
    7070        return EOK;
     
    185185       
    186186        const char *format = "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x";
    187         if(uppercase)
     187        if (uppercase)
    188188                format = "%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X";
    189189
Note: See TracChangeset for help on using the changeset viewer.