diff --git a/ChangeLog b/ChangeLog index f57b9d0367..2f420e1f24 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Thu Sep 4 00:01:45 2008 Yusuke Endoh + + * test/etc/test_etc.rb (test_getpwuid, test_getgrgid): use + Process.euid and egid instead of Etc.getlogin to identify current + user which may be different from a login one (e.g., su command). + Wed Sep 3 23:52:47 2008 Yusuke Endoh * test/etc/test_etc.rb: check only typical use of diff --git a/test/etc/test_etc.rb b/test/etc/test_etc.rb index 712961939c..add7d63652 100644 --- a/test/etc/test_etc.rb +++ b/test/etc/test_etc.rb @@ -32,7 +32,7 @@ class TestEtc < Test::Unit::TestCase Etc.passwd {|s| passwd[s.uid] = s unless passwd[s.uid] } passwd.values.each do |s| assert_equal(s, Etc.getpwuid(s.uid)) - assert_equal(s, Etc.getpwuid) if Etc.getlogin == s.name + assert_equal(s, Etc.getpwuid) if Process.euid == s.uid end end @@ -73,7 +73,7 @@ class TestEtc < Test::Unit::TestCase end groups.each do |s| assert_equal(s, Etc.getgrgid(s.gid)) - assert_equal(s, Etc.getgrgid) if Etc.getlogin == s.name + assert_equal(s, Etc.getgrgid) if Process.egid == s.gid end end