[parted-devel] generate_random_id() fix

Jim Meyering jim at meyering.net
Wed Jul 11 22:46:15 UTC 2007


"H. Peter Anvin" <hpa at zytor.com> wrote:

> Jim Meyering wrote:
>> "H. Peter Anvin" <hpa at zytor.com> wrote:
>> ...
>>> I would avoid using the UUID, since the UUID is not guaranteed to be
>>> random in any way -- in fact, even for a "random" UUID there are at
>>> least 6 bits which are fixed.
>>>
>>> I don't know exactly what uuid_generate() does, so it's hard to say
>>> exactly if this is a problem or not.  At the very least I would XOR the
>>> different words of the UUID together.
>>
>> Oh!  Good point.
>> Knowing that, I prefer your code.
>> Just want to use it from both places.
>> Do you feel like doing that?
>
> I can do it, although it might make more sense to move this to a
> separate file,

Thanks.
One way would be to append these lines to lib/Makefile.am

  libparted_a_SOURCES += \
    rand-whatever.c rand-whatever.h

and to put the function/prototype in lib/rand-whatever.[ch].

> and that means digging more into how you have the source
> code set up.



More information about the parted-devel mailing list