Class: PatchELF::Saver
- Inherits:
-
Object
- Object
- PatchELF::Saver
- Defined in:
- lib/patchelf/saver.rb
Overview
Internal use only.
For Patcher to do patching things and save to file.
Instance Attribute Summary collapse
-
#in_file ⇒ String
readonly
Input filename.
-
#out_file ⇒ String
readonly
Output filename.
Instance Method Summary collapse
-
#initialize(in_file, out_file, set) ⇒ Saver
constructor
Instantiate a Saver object.
- #save! ⇒ void
Constructor Details
#initialize(in_file, out_file, set) ⇒ Saver
Instantiate a PatchELF::Saver object.
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/patchelf/saver.rb', line 24 def initialize(in_file, out_file, set) @in_file = in_file @out_file = out_file @set = set # [{Integer => String}] @inline_patch = {} @elf = ELFTools::ELFFile.new(File.open(in_file)) @mm = PatchELF::MM.new(@elf) @strtab_extend_requests = [] @append_dyn = [] end |
Instance Attribute Details
#in_file ⇒ String (readonly)
Returns Input filename.
17 18 19 |
# File 'lib/patchelf/saver.rb', line 17 def in_file @in_file end |
#out_file ⇒ String (readonly)
Returns Output filename.
18 19 20 |
# File 'lib/patchelf/saver.rb', line 18 def out_file @out_file end |
Instance Method Details
#save! ⇒ void
This method returns an undefined value.
37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/patchelf/saver.rb', line 37 def save! # In this method we assume all attributes that should exist do exist. # e.g. DT_INTERP, DT_DYNAMIC. These should have been checked in the patcher. patch_interpreter patch_dynamic @mm.dispatch! FileUtils.cp(in_file, out_file) if out_file != in_file patch_out(@out_file) # Let output file have the same permission as input. FileUtils.chmod(File.stat(in_file).mode, out_file) end |