[Olsr-dev] [PATCH v1 1/1] main: improve random number generator seed

Ferry Huberts (spam-protected)
Tue Nov 13 08:34:24 CET 2012



On 13/11/12 08:11, Roar Bjørgum Rotvik wrote:
> On 11/10/2012 11:50 AM, Ferry Huberts wrote:
>> From: Ferry Huberts <(spam-protected)>
>> +    if (read(randomFile, &seed, sizeof(seed)) != sizeof(seed)) {
>> +      ; /* to fix an 'unused result' compiler warning */
>> +    }
>
> Wouldn't this code line be nicer and easier to understand than the code
> above (if you ignore the result from read() anyhow)?
>
> (void)read(randomFile, &seed, sizeof(seed));
>

tried that. didn't work. probably because the Linux headers declare the 
function with an explicit 'warn on unused result' gcc attribute.

-- 
Ferry Huberts




More information about the Olsr-dev mailing list