From: Michael Tremer Date: Tue, 13 Jun 2017 18:24:41 +0000 (+0100) Subject: device_get_speed(): Break if speed is not readable X-Git-Tag: 009~220 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f887607cc3da5271d3d475e366b13beec0b27664;p=network.git device_get_speed(): Break if speed is not readable This is usually the case when a device has no link (i.e. the speed is unknown). Signed-off-by: Michael Tremer --- diff --git a/src/functions/functions.device b/src/functions/functions.device index 32108bb0..ac6ace5b 100644 --- a/src/functions/functions.device +++ b/src/functions/functions.device @@ -862,6 +862,9 @@ device_get_speed() { local speed=$(__device_get_file ${device} speed) + # Exit for no output (i.e. no link detected) + isset speed || return ${EXIT_ERROR} + # Don't return anything for negative values [ ${speed} -lt 0 ] && return ${EXIT_ERROR}