From a6df8785d8e51a1b4a916bfb1e555b253aa9cbfd Mon Sep 17 00:00:00 2001
From: Jack Nagel <jacknagel@gmail.com>
Date: Fri, 10 Oct 2014 20:25:38 -0500
Subject: [PATCH] Handle read(n) returning nil

Fixes Homebrew/homebrew#33090.
---
 Library/Homebrew/mach.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Library/Homebrew/mach.rb b/Library/Homebrew/mach.rb
index de38d296bf..ff3b76d2d9 100644
--- a/Library/Homebrew/mach.rb
+++ b/Library/Homebrew/mach.rb
@@ -60,7 +60,7 @@ module MachO
     offsets = []
     mach_data = []
 
-    header = read(8).unpack("N2")
+    header = (read(8) || "").unpack("N2")
     case header[0]
     when 0xcafebabe # universal
       header[1].times do |i|
-- 
GitLab