Hi,

looking through the source code, I may have spotted a bug in ifplugd.

The variable "delay_time" is used to hold a monotonic clock time but it is
also set/compared to special value 0.

In about 68 years the monotonic (32 bit int) clock arrives back at 0. If
the monotonic clock starts at some other value, arriving at 0 can happen a
lot sooner. For this "wrapped" value 0 case, the script will erroneously
not be executed.

I see two possible solutions:

1) Add back a workaround that increases the value to 1 in this case. (This
solution seems to be in previous versions of busybox, before the "1970"
comment was added..)  However, this workaround will introduce an extra
delay of 1 second.

There is already some code guarded with "#if 0", but enabling this code can
 bring additional delays due to the (unnecessary?) sleep(1).

2) A cleaner solution would be to introduce a separate flag variable that
is set/reset/checked and variable delay_time would then only be used for
monotonic clock comparisons.

Any comments ?

Best regards,
Karl
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to