keg_relocate: Exclude hardlinks from mach_o_files.
This commit is contained in:
parent
d4f5f0cec7
commit
d3ef56425a
@ -157,10 +157,15 @@ class Keg
|
|||||||
end
|
end
|
||||||
|
|
||||||
def mach_o_files
|
def mach_o_files
|
||||||
|
hardlinks = Set.new
|
||||||
mach_o_files = []
|
mach_o_files = []
|
||||||
path.find do |pn|
|
path.find do |pn|
|
||||||
next if pn.symlink? || pn.directory?
|
next if pn.symlink? || pn.directory?
|
||||||
mach_o_files << pn if pn.dylib? || pn.mach_o_bundle? || pn.mach_o_executable?
|
next unless pn.dylib? || pn.mach_o_bundle? || pn.mach_o_executable?
|
||||||
|
# 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]
|
||||||
|
mach_o_files << pn
|
||||||
end
|
end
|
||||||
|
|
||||||
mach_o_files
|
mach_o_files
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user