* lib/fileutils.rb (FileUtils#fu_get_uid, fu_get_gid): Do not
convert an integer back and forth. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25433 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
6221d16ffb
commit
da54a4589a
@ -1,3 +1,8 @@
|
|||||||
|
Thu Oct 22 17:49:05 2009 Akinori MUSHA <knu@iDaemons.org>
|
||||||
|
|
||||||
|
* lib/fileutils.rb (FileUtils#fu_get_uid, fu_get_gid): Do not
|
||||||
|
convert an integer back and forth.
|
||||||
|
|
||||||
Thu Oct 22 17:29:51 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Thu Oct 22 17:29:51 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* parse.y (arg_prepend): removed. a patch from Mikhail T. in
|
* parse.y (arg_prepend): removed. a patch from Mikhail T. in
|
||||||
|
@ -977,20 +977,26 @@ module FileUtils
|
|||||||
|
|
||||||
def fu_get_uid(user) #:nodoc:
|
def fu_get_uid(user) #:nodoc:
|
||||||
return nil unless user
|
return nil unless user
|
||||||
user = user.to_s
|
case user
|
||||||
if /\A\d+\z/ =~ user
|
when Integer
|
||||||
then user.to_i
|
user
|
||||||
else Etc.getpwnam(user).uid
|
when /\A\d+\z/
|
||||||
|
user.to_i
|
||||||
|
else
|
||||||
|
Etc.getpwnam(user).uid
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
private_module_function :fu_get_uid
|
private_module_function :fu_get_uid
|
||||||
|
|
||||||
def fu_get_gid(group) #:nodoc:
|
def fu_get_gid(group) #:nodoc:
|
||||||
return nil unless group
|
return nil unless group
|
||||||
group = group.to_s
|
case group
|
||||||
if /\A\d+\z/ =~ group
|
when Integer
|
||||||
then group.to_i
|
group
|
||||||
else Etc.getgrnam(group).gid
|
when /\A\d+\z/
|
||||||
|
group.to_i
|
||||||
|
else
|
||||||
|
Etc.getgrnam(group).gid
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
private_module_function :fu_get_gid
|
private_module_function :fu_get_gid
|
||||||
|
Loading…
x
Reference in New Issue
Block a user