mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Check for the privileges by the current process groups
Group membership of login user is not activated until login after adding to the group.
This commit is contained in:
parent
3b86ec2251
commit
b89f6ac843
1 changed files with 1 additions and 3 deletions
|
@ -19,9 +19,7 @@ if RUBY_PLATFORM =~ /linux/
|
||||||
impl = :stap
|
impl = :stap
|
||||||
begin
|
begin
|
||||||
require 'etc'
|
require 'etc'
|
||||||
login = Etc.getlogin
|
ok = (%w[stapusr stapdev].map {|g|Etc.getgrnam(g).gid} & Process.groups).size == 2
|
||||||
ok = Etc.getgrnam('stapusr').mem.include?(login) &&
|
|
||||||
Etc.getgrnam('stapdev').mem.include?(login)
|
|
||||||
rescue LoadError, ArgumentError
|
rescue LoadError, ArgumentError
|
||||||
end unless ok
|
end unless ok
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue