Re: [PATCH] hwclock: fix --rtc option

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

 



Mike Frysinger <vapier@xxxxxxxxxx> 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 majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux