[OpenWrt-Devel] [PATCH] base-files: For sysfixtime use hwclock if RTC available

Daniel Dickinson openwrt at daniel.thecshore.com
Mon Jan 11 03:19:15 EST 2016


On 10/01/16 06:42 AM, bittorf wireless )) Bastian Bittorf wrote:
>> +
>> +start() {
>> +	if [ -e /dev/rtc ]; then
>> +		hwclock -s
> please use the short form [ -e /dev/rtc ] && ...

Per private mail I've learned this is the current codebase standard, so 
will follow that, but the reason I tend to prefer the if..then is that 
if..then has the correct semantics when using set -e (that is causes 
termination on error, but not under normal operation) whereas [ xx ] && 
yy is not set -e safe and simply adding || true results in error 
conditions not being detected, so it is actually doing the wrong thing 
if you use set -e (unless the initial condition being false is an error 
and not just normal operation).


openwrt-devel mailing list
openwrt-devel at lists.openwrt.org

More information about the openwrt-devel mailing list