[Pm-utils] [PATCH 3/7] (pm-utils 1.2.4) hal-get-property runs just fine as a normal user

Michael Biebl mbiebl at gmail.com
Thu Jan 29 10:32:43 PST 2009


2009/1/29 Victor Lowther <victor.lowther at gmail.com>:
> ---
>  pm/pm-functions.in |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/pm/pm-functions.in b/pm/pm-functions.in
> index f5cc400..9a3097e 100644
> --- a/pm/pm-functions.in
> +++ b/pm/pm-functions.in
> @@ -79,7 +79,7 @@ done
>
>  . "${PM_FUNCTIONS}"
>
> -if [ "$(id -u)" = "0" ] && command_exists hal-get-property; then
> +if command_exists hal-get-property; then
>     export CHASSIS_TYPE="$(hal-get-property --udi /org/freedesktop/Hal/devices/computer --key system.chassis.type)"
>  else
>     export CHASSIS_TYPE=Unknown

Hi,

I think we should check the return code of hal-get-property and set
CHASSIS_TYPE=Unknown if != 0
We should also avoid to print error messages of hal-get-property to stderr.

See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=511466 for reference.

Cheers,
Michael

-- 
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?


More information about the Pm-utils mailing list