Skip to content

Commit

Permalink
Couple of minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
bjorn3 authored and folkertdev committed Nov 13, 2024
1 parent 0025bb7 commit d7659cb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 1 addition & 4 deletions bzip2recover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,15 +347,12 @@ fn main_help(program_name: &Path, in_filename: &Path) -> Result<(), Error> {
);

let mut options = std::fs::File::options();
options.write(true).create(true);
options.write(true).create_new(true);

#[cfg(unix)]
#[allow(clippy::unnecessary_cast)]
options.mode(libc::S_IWUSR as u32 | libc::S_IRUSR as u32);

#[cfg(unix)]
options.custom_flags(libc::O_EXCL);

let Ok(output_file) = options.open(&out_filename) else {
eprintln!("{}: can't write `{}'", progname, out_filename.display());

Expand Down
4 changes: 3 additions & 1 deletion test-libbzip2-rs-sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
use std::{
ffi::{c_char, c_int, c_void, CStr},
mem::MaybeUninit,
os::fd::{AsRawFd, IntoRawFd},
path::{Path, PathBuf},
};

Expand Down Expand Up @@ -1319,7 +1318,10 @@ mod high_level_interface {
}

#[test]
#[cfg(unix)]
fn open_and_close() {
use std::os::fd::{AsRawFd, IntoRawFd};

let p = std::env::temp_dir().join("open_and_close.bz2");

const RB: *const c_char = b"rb\0".as_ptr().cast::<c_char>();
Expand Down

0 comments on commit d7659cb

Please sign in to comment.