diff options
author | Jesse Luehrs <doy@tozt.net> | 2020-07-17 03:05:04 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2020-07-17 03:05:04 -0400 |
commit | 2d3e62e97d1dc80594bdb302426cc226c6a9735c (patch) | |
tree | d21373db17c6407f0e36d87278c339c62fcf5f60 /src/command.rs | |
parent | 47f23f518e9b935943b5e71ccd0cbc978aff433f (diff) | |
download | pty-process-2d3e62e97d1dc80594bdb302426cc226c6a9735c.tar.gz pty-process-2d3e62e97d1dc80594bdb302426cc226c6a9735c.zip |
move some more code out of unsafe
Diffstat (limited to 'src/command.rs')
-rw-r--r-- | src/command.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/command.rs b/src/command.rs index 3c46739..4f8f808 100644 --- a/src/command.rs +++ b/src/command.rs @@ -110,11 +110,10 @@ nix::ioctl_write_ptr_bad!( libc::c_int ); -fn set_controlling_terminal(fh: &std::fs::File) -> nix::Result<()> { +fn set_controlling_terminal(file: &std::fs::File) -> nix::Result<()> { + let fd = file.as_raw_fd(); // safe because std::fs::File is required to contain a valid file // descriptor - unsafe { - set_controlling_terminal_unsafe(fh.as_raw_fd(), std::ptr::null()) - } - .map(|_| ()) + unsafe { set_controlling_terminal_unsafe(fd, std::ptr::null()) } + .map(|_| ()) } |