Skip to content

Commit

Permalink
Add getuid example
Browse files Browse the repository at this point in the history
  • Loading branch information
matsumotory committed Dec 6, 2013
1 parent cd5eb0e commit 5ea93d0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions example/setuid.rb → example/setgetuid.rb
@@ -1,5 +1,5 @@
#
# use mruby-process, mruby-random, mruby-capability
# use mruby-process, mruby-sleep, mruby-capability
#

c = Capability.new
Expand All @@ -10,10 +10,11 @@
loop do
c.get_proc
c.set Capability::CAP_EFFECTIVE, cap
sleep 2
uid = Random::rand(1000)
puts uid
puts "setuid #{uid}"
c.setuid(uid)
puts "getuid #{c.getuid}"
sleep 5
c.clear Capability::CAP_EFFECTIVE, cap
end
}
Expand Down

0 comments on commit 5ea93d0

Please sign in to comment.