We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2ffd5df commit 82ac114Copy full SHA for 82ac114
virtio-devices/src/vsock/unix/muxer.rs
@@ -495,11 +495,10 @@ impl VsockMuxer {
495
const MIN_COMMAND_LEN: usize = 10;
496
497
// Bring in the minimum number of bytes that we should be able to read.
498
- if command.len < MIN_COMMAND_LEN {
499
- command.len += stream
500
- .read(&mut command.buf[command.len..MIN_COMMAND_LEN])
501
- .map_err(Error::UnixRead)?;
502
- }
+ stream
+ .read_exact(&mut command.buf[command.len..MIN_COMMAND_LEN])
+ .map_err(Error::UnixRead)?;
+ command.len = MIN_COMMAND_LEN;
503
504
// Now, finish reading the destination port number, by bringing in one byte at a time,
505
// until we reach an EOL terminator (or our buffer space runs out). Yeah, not
0 commit comments