vmm: Don't assume that resize_pipe is initialised

If the underlying kernel is old PTY resize is disabled and this is
represented by the use of None in the provided Option<File> type. In the
virtio-console PTY path don't blindly unwrap() the value that will be
preserved across a reboot.

Fixes: #3496

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
(cherry picked from commit a749063c8a)
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
Rob Bradford 2022-01-04 10:54:30 +00:00
parent 758ef9604a
commit 0f54fb1f5f

View File

@ -1742,7 +1742,7 @@ impl DeviceManager {
self.config.lock().unwrap().console.file = Some(pty.path.clone());
let file = pty.main.try_clone().unwrap();
self.console_pty = Some(Arc::new(Mutex::new(pty)));
self.console_resize_pipe = Some(Arc::new(resize_pipe.unwrap()));
self.console_resize_pipe = resize_pipe.map(Arc::new);
Endpoint::FilePair(file.try_clone().unwrap(), file)
} else {
let (main, mut sub, path) =