Re: [PATCH BlueZ] plugins: Fix compilation error on autopair

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Marcel,

On Thu, May 16, 2013 at 10:07 AM, Marcel Holtmann <marcel@xxxxxxxxxxxx> wrote:
>>       f = fopen("/dev/urandom", "rb");
>>       if (f != NULL) {
>> -             fread(&seed, sizeof(seed), 1, f);
>> +             nread = fread(&seed, sizeof(seed), 1, f);
>>               fclose(f);
>>       }
>>
>> +     if (f == NULL || nread != 1)
>> +             seed = time(NULL);
>> +
>>       srand(seed);
>
> lets redo this in actually readable code ;)
>
> Checking f twice is not acceptable. And I still wonder why fopen() is here preferred over open().

I just sent another version that uses open()/read() instead.
Compilation tested only.

Regards,
-- 
Anderson Lizardo
Instituto Nokia de Tecnologia - INdT
Manaus - Brazil
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux