Skip to content

Commit

Permalink
Merge pull request #7 from lucab/ups/backdoor-iopl-errno
Browse files Browse the repository at this point in the history
backdoor: use proper errno on iopl failures
  • Loading branch information
lucab authored Sep 15, 2020
2 parents c4c1251 + a9eec49 commit 999c62a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ description = 'A pure-Rust library for VMware host-guest protocol ("VMXh backdoo
[dependencies]
cfg-if = "^0.1"
libc = "^0.2"
errno = "^0.2"
log = "^0.4"
thiserror = "^1.0"

Expand Down
3 changes: 2 additions & 1 deletion src/backdoor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ impl BackdoorGuard {
let level = if acquire { 0b11 } else { 0b00 };
let err = unsafe { libc::iopl(level) };
if err != 0 {
return Err(format!("iopl failed, errno={}", err).into());
let err_code = errno::errno();
return Err(format!("iopl failed: {} (errno: {})", err_code, err_code.0).into());
};

Ok(())
Expand Down

0 comments on commit 999c62a

Please sign in to comment.