diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-12-16 10:49:12 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-12-16 10:49:12 +0000 |
commit | 56709edc8972a0de8dee523f00576f32ebefb4ad (patch) | |
tree | 3fb0bcebba1366187c66bfa8785e5f954fbf4264 /test/test_pty.rb | |
parent | ce17decdfb5c785df7ca849178bfb74be5255553 (diff) | |
download | ruby-56709edc8972a0de8dee523f00576f32ebefb4ad.tar.gz |
* ext/pty/extconf.rb: check posix_openpt.
* ext/pty/pty.c (get_device_once): use posix_openpt if available.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20793 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/test_pty.rb')
-rw-r--r-- | test/test_pty.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/test_pty.rb b/test/test_pty.rb index 684ab2c01b..704861dd3c 100644 --- a/test/test_pty.rb +++ b/test/test_pty.rb @@ -98,5 +98,24 @@ class TestPTY < Test::Unit::TestCase } end + def test_stat_slave + # If grantpt is used, the slave device is changed as follows. + # owner: real UID + # group: an unspecified value (e.g. tty) + # mode: 0620 (rw--w----) + # + # The group is not testable because unspecified. + # + # The mode is testable but the condition is relaxed because other + # pty functions (openpty, _getpty, etc.) may not use 0620. + # But no one can read from the tty, I hope (for security reason). + # + PTY.open {|master, slave| + s = File.stat(slave.path) + assert_equal(Process.uid, s.uid) + assert_equal(0600, s.mode & 0755) + } + end + end if defined? PTY |