From 59203c63bb777a3bacec32fb8830fba33540e809 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 12 Jun 2024 07:35:29 +0200 Subject: Adding upstream version 127.0. Signed-off-by: Daniel Baumann --- third_party/rust/nix/src/pty.rs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'third_party/rust/nix/src/pty.rs') diff --git a/third_party/rust/nix/src/pty.rs b/third_party/rust/nix/src/pty.rs index 455828b703..74f8ecf0df 100644 --- a/third_party/rust/nix/src/pty.rs +++ b/third_party/rust/nix/src/pty.rs @@ -71,7 +71,7 @@ impl io::Read for PtyMaster { impl io::Write for PtyMaster { fn write(&mut self, buf: &[u8]) -> io::Result { - unistd::write(self.0.as_raw_fd(), buf).map_err(io::Error::from) + unistd::write(&self.0, buf).map_err(io::Error::from) } fn flush(&mut self) -> io::Result<()> { Ok(()) @@ -86,7 +86,7 @@ impl io::Read for &PtyMaster { impl io::Write for &PtyMaster { fn write(&mut self, buf: &[u8]) -> io::Result { - unistd::write(self.0.as_raw_fd(), buf).map_err(io::Error::from) + unistd::write(&self.0, buf).map_err(io::Error::from) } fn flush(&mut self) -> io::Result<()> { Ok(()) @@ -169,12 +169,12 @@ pub fn posix_openpt(flags: fcntl::OFlag) -> Result { /// For a threadsafe and non-`unsafe` alternative on Linux, see `ptsname_r()`. #[inline] pub unsafe fn ptsname(fd: &PtyMaster) -> Result { - let name_ptr = libc::ptsname(fd.as_raw_fd()); + let name_ptr = unsafe { libc::ptsname(fd.as_raw_fd()) }; if name_ptr.is_null() { return Err(Errno::last()); } - let name = CStr::from_ptr(name_ptr); + let name = unsafe { CStr::from_ptr(name_ptr) }; Ok(name.to_string_lossy().into_owned()) } @@ -187,8 +187,7 @@ pub unsafe fn ptsname(fd: &PtyMaster) -> Result { /// /// This value is useful for opening the slave ptty once the master has already been opened with /// `posix_openpt()`. -#[cfg(any(target_os = "android", target_os = "linux"))] -#[cfg_attr(docsrs, doc(cfg(all())))] +#[cfg(linux_android)] #[inline] pub fn ptsname_r(fd: &PtyMaster) -> Result { let mut name_buf = Vec::::with_capacity(64); @@ -342,7 +341,7 @@ pub unsafe fn forkpty<'a, 'b, T: Into>, U: Into ForkResult::Child, @@ -350,7 +349,7 @@ pub unsafe fn forkpty<'a, 'b, T: Into>, U: Into