Closed
Description
Currently, AFAIK, this is the only way to manipulate a file using a file descriptor directly without writing an unsafe block. If this trait remains safe, the following MemoryMap interface (for example) can't be safe:
struct MemoryMap {
//...
}
impl MemoryMap {
fn new(file: File) -> io::Result<MemoryMap> {
// ...
}
// ...
}
fn main() {
let f = File::create(...);
let f2 = File::from_raw_fd(f.as_raw_fd());
let m = MemoryMap::new(f).unwrap();
drop(f2);
// Use m and segfault...
}
Metadata
Metadata
Assignees
Labels
No labels