Mike Frysinger <[EMAIL PROTECTED]> writes:

> On Wednesday 19 September 2007, Matthias Koenig wrote:
>> --- a/hwclock/rtc.c
>> +++ b/hwclock/rtc.c
>> +    int fd;
>>
>> +    /* --rtc option has been given */
>> +    if (rtc_dev_name) {
>> +            fd = open(rtc_dev_name, O_RDONLY);
>> +
>> +            if (fd < 0 && errno == ENOENT)
>> +                    return -1;
>> +            else
>> +                    return fd;
>> +    }
>
> err, this looks pretty redundant to me ... the only value less than 0 that 
> open() can ever return is -1 ... and even if fd is -1 but errno is not 
> ENOENT, the return value is still just -1 ... so really the code should read:
> if (rtc_dev_name)
>       return open(rtc_dev_name, O_RDONLY);

Uhm, yes, you are right.

Thanks,
Matthias
-
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to