keg_relocate: Exclude hardlinks from mach_o_files.

This commit is contained in:
William Woodruff 2016-06-24 21:27:52 -04:00 committed by Tim D. Smith
parent 1668e47d1e
commit 3e5e14a595

View File

@ -157,8 +157,12 @@ class Keg
end
def mach_o_files
hardlinks = Set.new
mach_o_files = []
path.find do |pn|
# if we've already processed a file, ignore its hardlinks (which have the same dev ID and inode)
# this prevents relocations from being performed on a binary more than once
next unless hardlinks.add? [pn.stat.dev, pn.stat.ino]
next if pn.symlink? || pn.directory?
mach_o_files << pn if pn.dylib? || pn.mach_o_bundle? || pn.mach_o_executable?
end