Skip to content

Commit

Permalink
Update elf dependency to v0.7.0 (#205)
Browse files Browse the repository at this point in the history
  • Loading branch information
cole14 authored Nov 15, 2022
1 parent 4401d78 commit 77b3a4f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ status = ["atty", "indicatif"]
byteorder = "1.3"
bytes = "1.2"
clap = {version="4.0", default-features=false, features=["derive", "std", "usage", "error-context", "help"]}
elf = "0.6"
elf = "0.7"
futures = "0.3"
http = "0.2"
md5 = "0.7"
Expand Down
10 changes: 4 additions & 6 deletions src/snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::{
image::{Block, Image},
};
use clap::ValueEnum;
use elf::{gabi::PT_LOAD, segment::ProgramHeader, CachedReadBytes};
use elf::{abi::PT_LOAD, endian::NativeEndian, segment::ProgramHeader};
use std::{
fs::{metadata, OpenOptions},
ops::Range,
Expand Down Expand Up @@ -242,12 +242,10 @@ impl<'a, 'b> Snapshot<'a, 'b> {

let mut image = Image::new(self.version, Path::new("/proc/kcore"), self.destination)?;

let elf_handle = CachedReadBytes::new(&mut image.src);

let mut file = elf::File::open_stream(elf_handle).map_err(Error::Elf)?;
let mut segments: Vec<ProgramHeader> = file
let file =
elf::ElfStream::<NativeEndian, _>::open_stream(&mut image.src).map_err(Error::Elf)?;
let mut segments: Vec<&ProgramHeader> = file
.segments()
.map_err(Error::Elf)?
.iter()
.filter(|x| x.p_type == PT_LOAD)
.collect();
Expand Down

0 comments on commit 77b3a4f

Please sign in to comment.