[LEDE-DEV] [PATCH] base-files: rc.common: fix enable() return code and logic
Roman Yeryomin
roman at advem.lv
Wed Dec 27 05:42:28 PST 2017
On 2017-12-26 10:39, Karl Palsson wrote:
> Roman Yeryomin <roman at advem.lv> wrote:
>> On 2017-12-21 21:35, Roman Yeryomin wrote:
>> > In current state, if there is STOP but no START, enbale()
>> > will return 0 (success), which is wrong.
>> > Moreover there is no need to check for START/STOP twice.
>> > Instead, add err variable to save success state and
>> > and return it's value.
>> > Also eliminate the need to disable() by using 'ln -sf',
>> > which will first delete the old symlink if one exists.
>> >
>>
>> Ah, mistake in description, if there is no STOP it returns 1,
>> which is wrong. Will resend with corrected description.
>
> What do you mean? Are you saying that "enable" doesn't work if
> STOP isn't defined? because that's clearly not the case...
>
I didn't say it doesn't work, I said it is returning 1, which is error
indication.
Look at first check which returns 1 if there is no neither STOP nor
START. It will pass if there is no STOP but afterwards second check will
fail and enable() will return 1 anyway.
It's pretty obvious that the logic is broken. If you implement error
checking when using enable() then your check will be broken.
Regards,
Roman
More information about the Lede-dev
mailing list