diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-04-24 14:19:21 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-04-24 14:19:21 +0000 |
commit | 3c00fe9f419cef63520f16b051950a5693d74d6e (patch) | |
tree | 685672ded33d665ba107865810294777b66276fc /lib/webrick/utils.rb | |
parent | a87c3b4869daaadbeeea0b5b067bc9cd19ac4911 (diff) |
* lib/fileutils.rb (fu_get_uid, fu_get_gid): Etc.getpwnam/getgrnam may
returns nil.
* lib/webrick/utils.rb (su): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45712 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/webrick/utils.rb')
-rw-r--r-- | lib/webrick/utils.rb | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/webrick/utils.rb b/lib/webrick/utils.rb index a6b5cc6a9c..185b1723f3 100644 --- a/lib/webrick/utils.rb +++ b/lib/webrick/utils.rb @@ -41,8 +41,7 @@ module WEBrick ## # Changes the process's uid and gid to the ones of +user+ def su(user) - if defined?(Etc) - pw = Etc.getpwnam(user) + if defined?(Etc) && (pw = Etc.getpwnam(user)) Process::initgroups(user, pw.gid) Process::Sys::setgid(pw.gid) Process::Sys::setuid(pw.uid) |