From ca2fcc639c7363a04998f650b96573d806b32dd2 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 10 Jan 2018 08:30:25 +0100 Subject: apt-compat.cron.daily: Correctly handle undetermined power status If on_ac_power exits with 255 the script would fail at this point because set -e was set, but it should continue, as 255 means the power status could not be determined. LP: #1742378 --- debian/apt.apt-compat.cron.daily | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/debian/apt.apt-compat.cron.daily b/debian/apt.apt-compat.cron.daily index 095a44c4a..b0b553768 100644 --- a/debian/apt.apt-compat.cron.daily +++ b/debian/apt.apt-compat.cron.daily @@ -19,9 +19,9 @@ check_power() # 255 (false) Power status could not be determined # Desktop systems always return 255 it seems if which on_ac_power >/dev/null 2>&1; then - on_ac_power - POWER=$? - if [ $POWER -eq 1 ]; then + if on_ac_power; then + : + elif [ $? -eq 1 ]; then return 1 fi fi -- cgit v1.2.3