File tree Expand file tree Collapse file tree 2 files changed +3
-4
lines changed Expand file tree Collapse file tree 2 files changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -802,7 +802,7 @@ pub enum FcntlArg<'a> {
802
802
F_RDADVISE ( libc:: radvisory) ,
803
803
/// Pre-allocate storage with different policies on fd.
804
804
#[ cfg( apple_targets) ]
805
- F_PREALLOCATE ( & mut ' a libc:: fstore_t) ,
805
+ F_PREALLOCATE ( & ' a mut libc:: fstore_t) ,
806
806
// TODO: Rest of flags
807
807
}
808
808
Original file line number Diff line number Diff line change @@ -585,19 +585,18 @@ fn test_f_get_path() {
585
585
#[ test]
586
586
fn test_f_preallocate ( ) {
587
587
use nix:: fcntl:: * ;
588
- use std:: os:: unix:: io:: AsRawFd ;
589
588
590
589
let tmp = NamedTempFile :: new ( ) . unwrap ( ) ;
591
- let fd = tmp. as_raw_fd ( ) ;
592
590
let mut st: libc:: fstore_t = unsafe { std:: mem:: zeroed ( ) } ;
593
591
594
592
st. fst_flags = libc:: F_ALLOCATECONTIG as libc:: c_uint ;
595
593
st. fst_posmode = libc:: F_PEOFPOSMODE ;
596
594
st. fst_length = 1024 ;
597
595
let res =
598
- fcntl ( fd , FcntlArg :: F_PREALLOCATE ( & st) ) . expect ( "preallocation failed" ) ;
596
+ fcntl ( tmp , FcntlArg :: F_PREALLOCATE ( & mut st) ) . expect ( "preallocation failed" ) ;
599
597
600
598
assert_eq ! ( res, 0 ) ;
599
+ assert ! ( st. fst_bytesalloc > 0 ) ;
601
600
}
602
601
603
602
#[ cfg( apple_targets) ]
You can’t perform that action at this time.
0 commit comments