remove hard coding of path for id command

git-svn-id: file:///home/svn/framework3/trunk@12902 4d416f70-5f16-0410-b530-b9f4589650da
unstable
Carlos Perez 2011-06-10 11:14:57 +00:00
parent fbe81ed82a
commit 30caa5b60c
1 changed files with 5 additions and 1 deletions

View File

@ -9,9 +9,13 @@ module Priv
# Returns true if running as root, false if not.
def is_root?
root_priv = false
user_id = cmd_exec("/bin/id -u")
user_id = cmd_exec("id -u")
if user_id.to_i == 0
root_priv = true
elsif user_id =~ /^\d*$/
root_priv = false
else
raise "Could not determine UID: #{user_id}"
end
return root_priv
end