diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-09-13 06:02:59 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-09-13 06:02:59 +0000 |
commit | f7081431f2c645b198db8ca00ab195c6b8c3d189 (patch) | |
tree | e874d7f4bbfb8dc3716e80a2a95f6440cf17152f /lib/pstore.rb | |
parent | faa2bef46da2dd219e8eaecbd9e21821e3aa0ea9 (diff) | |
download | ruby-f7081431f2c645b198db8ca00ab195c6b8c3d189.tar.gz |
* lib/pstore.rb (PStore): always open in binary mode even if
default encodings are set. [Bug #5311] [ruby-core:39503]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33264 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/pstore.rb')
-rw-r--r-- | lib/pstore.rb | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/pstore.rb b/lib/pstore.rb index 9fb0249f3c..020b028666 100644 --- a/lib/pstore.rb +++ b/lib/pstore.rb @@ -94,10 +94,9 @@ require "thread" # Needless to say, if you're storing valuable data with PStore, then you should # backup the PStore files from time to time. class PStore - binmode = defined?(File::BINARY) ? File::BINARY : 0 - RDWR_ACCESS = File::RDWR | File::CREAT | binmode - RD_ACCESS = File::RDONLY | binmode - WR_ACCESS = File::WRONLY | File::CREAT | File::TRUNC | binmode + RDWR_ACCESS = {mode: IO::RDWR | IO::CREAT | IO::BINARY, encoding: Encoding::ASCII_8BIT}.freeze + RD_ACCESS = {mode: IO::RDONLY | IO::BINARY, encoding: Encoding::ASCII_8BIT}.freeze + WR_ACCESS = {mode: IO::WRONLY | IO::CREAT | IO::TRUNC | IO::BINARY, encoding: Encoding::ASCII_8BIT}.freeze # The error type thrown by all PStore methods. class Error < StandardError |