From c7560969dd8540fb1ee76b494d5e744ad15c5a3e Mon Sep 17 00:00:00 2001 From: Jan Macku Date: Tue, 16 Jun 2020 09:22:43 +0200 Subject: ifup-eth: Switch to bc utility, which supports floating point computations. backport of: 0be5319 Resolves: #1826637 --- network-scripts/ifup-eth | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'network-scripts') diff --git a/network-scripts/ifup-eth b/network-scripts/ifup-eth index b49af168..1d6f18e7 100755 --- a/network-scripts/ifup-eth +++ b/network-scripts/ifup-eth @@ -89,9 +89,11 @@ if [ "${TYPE}" = "Bridge" ]; then forward_delay="$(convert2sec ${forward_delay} centi)" fi - forward_delay=$(expr ${forward_delay} \* 2 + 7) + forward_delay=$(bc -q <<< "${forward_delay} * 2 + 7") - [ 0$LINKDELAY -lt $forward_delay ] && LINKDELAY=$forward_delay + # It's possible we are comparing floating point numbers here, therefore + # we are using 'bc' for comparison. The [ ] and [[ ]] do not work. + (( $(bc -l <<< "${LINKDELAY:-0} < ${forward_delay}") )) && LINKDELAY=${forward_delay} unset forward_delay fi -- cgit v1.2.1