diff options
author | Julian Andres Klode <jak@debian.org> | 2018-01-10 08:30:25 +0100 |
---|---|---|
committer | Julian Andres Klode <jak@debian.org> | 2018-01-10 08:33:41 +0100 |
commit | ca2fcc639c7363a04998f650b96573d806b32dd2 (patch) | |
tree | d426931ca5aaa951169c4182aedce7f2d9c9888e | |
parent | df2d614900476920671779f27fcc4143d3c1b5b7 (diff) |
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
-rw-r--r-- | debian/apt.apt-compat.cron.daily | 6 |
1 files 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 |