Skip to content

Commit d5c26cc

Browse files
committed
address remarks
1 parent b5b3594 commit d5c26cc

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

src/fcntl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,7 @@ pub enum FcntlArg<'a> {
802802
F_RDADVISE(libc::radvisory),
803803
/// Pre-allocate storage with different policies on fd.
804804
#[cfg(apple_targets)]
805-
F_PREALLOCATE(&mut 'a libc::fstore_t),
805+
F_PREALLOCATE(&'a mut libc::fstore_t),
806806
// TODO: Rest of flags
807807
}
808808

test/test_fcntl.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -585,19 +585,18 @@ fn test_f_get_path() {
585585
#[test]
586586
fn test_f_preallocate() {
587587
use nix::fcntl::*;
588-
use std::os::unix::io::AsRawFd;
589588

590589
let tmp = NamedTempFile::new().unwrap();
591-
let fd = tmp.as_raw_fd();
592590
let mut st: libc::fstore_t = unsafe { std::mem::zeroed() };
593591

594592
st.fst_flags = libc::F_ALLOCATECONTIG as libc::c_uint;
595593
st.fst_posmode = libc::F_PEOFPOSMODE;
596594
st.fst_length = 1024;
597595
let res =
598-
fcntl(fd, FcntlArg::F_PREALLOCATE(&st)).expect("preallocation failed");
596+
fcntl(tmp, FcntlArg::F_PREALLOCATE(&mut st)).expect("preallocation failed");
599597

600598
assert_eq!(res, 0);
599+
assert!(st.fst_bytesalloc > 0);
601600
}
602601

603602
#[cfg(apple_targets)]

0 commit comments

Comments
 (0)