Skip to content

Commit d4811a9

Browse files
committed
Remove usage of errno
1 parent e1cb4ba commit d4811a9

File tree

1 file changed

+2
-5
lines changed
  • library/std_detect/src/detect/os/linux

1 file changed

+2
-5
lines changed

library/std_detect/src/detect/os/linux/mod.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ fn read_file(orig_path: &str) -> Result<Vec<u8>, alloc::string::String> {
1515
unsafe {
1616
let file = libc::open(path.as_ptr() as *const libc::c_char, libc::O_RDONLY);
1717
if file == -1 {
18-
return Err(format!("Cannot open file at {orig_path}: {}", *libc::__errno_location()));
18+
return Err(format!("Cannot open file at {orig_path}"));
1919
}
2020

2121
let mut data = Vec::new();
@@ -25,10 +25,7 @@ fn read_file(orig_path: &str) -> Result<Vec<u8>, alloc::string::String> {
2525
match libc::read(file, spare.as_mut_ptr() as *mut _, spare.len()) {
2626
-1 => {
2727
libc::close(file);
28-
return Err(format!(
29-
"Error while reading from file at {orig_path}: {}",
30-
*libc::__errno_location()
31-
));
28+
return Err(format!("Error while reading from file at {orig_path}"));
3229
}
3330
0 => break,
3431
n => data.set_len(data.len() + n as usize),

0 commit comments

Comments
 (0)