mirror of
https://github.com/ruby/ruby.git
synced 2026-10-28 16:36:20 +08: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:
1 file changed
+1
-3
@@ -19,9 +19,7 @@ if RUBY_PLATFORM =~ /linux/
|
||||
impl = :stap
|
||||
begin
|
||||
require 'etc'
|
||||
login = Etc.getlogin
|
||||
ok = Etc.getgrnam('stapusr').mem.include?(login) &&
|
||||
Etc.getgrnam('stapdev').mem.include?(login)
|
||||
ok = (%w[stapusr stapdev].map {|g|Etc.getgrnam(g).gid} & Process.groups).size == 2
|
||||
rescue LoadError, ArgumentError
|
||||
end unless ok
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user