mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
Use mutable pointers for Unix path buffers
This commit is contained in:
@@ -339,7 +339,7 @@ fn get_path(fd: c_int) -> Option<PathBuf> {
|
||||
// alternatives. If a better method is invented, it should be used
|
||||
// instead.
|
||||
let mut buf = vec![0; libc::PATH_MAX as usize];
|
||||
let n = unsafe { libc::fcntl(fd, libc::F_GETPATH, buf.as_ptr()) };
|
||||
let n = unsafe { libc::fcntl(fd, libc::F_GETPATH, buf.as_mut_ptr()) };
|
||||
if n == -1 {
|
||||
cfg_select! {
|
||||
target_os = "netbsd" => {
|
||||
@@ -375,7 +375,7 @@ fn get_path(fd: c_int) -> Option<PathBuf> {
|
||||
#[cfg(target_os = "vxworks")]
|
||||
fn get_path(fd: c_int) -> Option<PathBuf> {
|
||||
let mut buf = vec![0; libc::PATH_MAX as usize];
|
||||
let n = unsafe { libc::ioctl(fd, libc::FIOGETNAME, buf.as_ptr()) };
|
||||
let n = unsafe { libc::ioctl(fd, libc::FIOGETNAME, buf.as_mut_ptr()) };
|
||||
if n == -1 {
|
||||
return None;
|
||||
}
|
||||
|
||||
@@ -207,7 +207,7 @@ fn sysctl() -> io::Result<PathBuf> {
|
||||
cvt(libc::sysctl(
|
||||
mib.as_ptr(),
|
||||
mib.len() as libc::c_uint,
|
||||
path.as_ptr() as *mut libc::c_void,
|
||||
path.as_mut_ptr() as *mut libc::c_void,
|
||||
&mut path_len,
|
||||
ptr::null(),
|
||||
0,
|
||||
|
||||
Reference in New Issue
Block a user