aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/extend/pathname.rb
diff options
context:
space:
mode:
authorJack Nagel2013-09-16 12:50:31 -0500
committerJack Nagel2013-09-16 12:50:31 -0500
commite2554ccbe927a4dc002ff7aad84d4301f30dcdbb (patch)
tree4eb767c148499a484cd51a357c884cd9c665fa72 /Library/Homebrew/extend/pathname.rb
parent4656e399f5df8e58e468eb06d40f578babbf90ec (diff)
downloadhomebrew-e2554ccbe927a4dc002ff7aad84d4301f30dcdbb.tar.bz2
Open files in binary mode where appropriate
Diffstat (limited to 'Library/Homebrew/extend/pathname.rb')
-rw-r--r--Library/Homebrew/extend/pathname.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/Library/Homebrew/extend/pathname.rb b/Library/Homebrew/extend/pathname.rb
index cdc5907c5..d39b692ad 100644
--- a/Library/Homebrew/extend/pathname.rb
+++ b/Library/Homebrew/extend/pathname.rb
@@ -174,7 +174,7 @@ class Pathname
# Get enough of the file to detect common file types
# POSIX tar magic has a 257 byte offset
# magic numbers stolen from /usr/share/file/magic/
- case open { |f| f.read(262) }
+ case open('rb') { |f| f.read(262) }
when /^PK\003\004/n then :zip
when /^\037\213/n then :gzip
when /^BZh/n then :bzip2
@@ -200,7 +200,7 @@ class Pathname
def incremental_hash(hasher)
incr_hash = hasher.new
buf = ""
- open('r') { |f| incr_hash << buf while f.read(1024, buf) }
+ open('rb') { |f| incr_hash << buf while f.read(1024, buf) }
incr_hash.hexdigest
end