Fix use after free due to insufficient lifetime

This commit is contained in:
Kevin Liu 2016-10-15 16:55:42 -07:00
parent a5f730bc38
commit 100bbc8bc9

View file

@ -219,12 +219,10 @@ fn copy_file(source: &Path, dest: &Path) -> io::Result<()> {
return Err(e);
}
} else if filetype.is_fifo() {
let path = std::ffi::CString::new(dest.to_str().unwrap())
.unwrap()
.as_ptr();
let path = std::ffi::CString::new(dest.to_str().unwrap()).unwrap();
let mode = metadata.permissions().mode();
unsafe {
libc::mkfifo(path, mode);
libc::mkfifo(path.as_ptr(), mode);
}
} else if filetype.is_symlink() {
let target = try!(fs::read_link(source));