mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-09-19 21:41:07 +00:00
vmm: Use cloned fd to check if dev is a tty
While checking if the console device is a tty use the cloned fd instead of libc::STDOUT_FILENO. Signed-off-by: Praveen K Paladugu <prapal@linux.microsoft.com>
This commit is contained in:
parent
c3fcddf830
commit
9f969ee18d
@ -205,7 +205,7 @@ pub(crate) fn pre_create_console_devices(vmm: &mut Vmm) -> ConsoleDeviceResult<C
|
|||||||
let stdout = unsafe { File::from_raw_fd(stdout) };
|
let stdout = unsafe { File::from_raw_fd(stdout) };
|
||||||
|
|
||||||
// SAFETY: FFI call. Trivially safe.
|
// SAFETY: FFI call. Trivially safe.
|
||||||
if unsafe { libc::isatty(libc::STDOUT_FILENO) } == 1 {
|
if unsafe { libc::isatty(stdout.as_raw_fd()) } == 1 {
|
||||||
vmm.console_resize_pipe = Some(
|
vmm.console_resize_pipe = Some(
|
||||||
listen_for_sigwinch_on_tty(
|
listen_for_sigwinch_on_tty(
|
||||||
stdout.try_clone().unwrap(),
|
stdout.try_clone().unwrap(),
|
||||||
@ -254,7 +254,7 @@ pub(crate) fn pre_create_console_devices(vmm: &mut Vmm) -> ConsoleDeviceResult<C
|
|||||||
let stdout = unsafe { File::from_raw_fd(stdout) };
|
let stdout = unsafe { File::from_raw_fd(stdout) };
|
||||||
|
|
||||||
// SAFETY: FFI call. Trivially safe.
|
// SAFETY: FFI call. Trivially safe.
|
||||||
if unsafe { libc::isatty(libc::STDOUT_FILENO) } == 1 {
|
if unsafe { libc::isatty(stdout.as_raw_fd()) } == 1 {
|
||||||
vmm.console_resize_pipe = Some(
|
vmm.console_resize_pipe = Some(
|
||||||
listen_for_sigwinch_on_tty(
|
listen_for_sigwinch_on_tty(
|
||||||
stdout.try_clone().unwrap(),
|
stdout.try_clone().unwrap(),
|
||||||
|
Loading…
Reference in New Issue
Block a user