From f887607cc3da5271d3d475e366b13beec0b27664 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Tue, 13 Jun 2017 19:24:41 +0100 Subject: [PATCH] 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 --- src/functions/functions.device | 3 +++ 1 file changed, 3 insertions(+) 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} -- 2.47.3