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);
-mike

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to