remove hard coding of path for id command
git-svn-id: file:///home/svn/framework3/trunk@12902 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
fbe81ed82a
commit
30caa5b60c
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue