Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/remote/remote_driver.c | 2 +-
src/rpc/virnetclientstream.c | 9 ++++++++-
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index dc59034c3..d27e96ffc 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -5652,7 +5652,7 @@ remoteStreamRecvFlags(virStreamPtr st,
virNetClientStreamPtr privst = st->privateData;
int rv;
- virCheckFlags(0, -1);
+ virCheckFlags(VIR_STREAM_RECV_STOP_AT_HOLE, -1);
if (virNetClientStreamRaiseError(privst))
return -1;
diff --git a/src/rpc/virnetclientstream.c b/src/rpc/virnetclientstream.c
index 75ec3f57f..e68d8f946 100644
--- a/src/rpc/virnetclientstream.c
+++ b/src/rpc/virnetclientstream.c
@@ -467,7 +467,7 @@ int virNetClientStreamRecvPacket(virNetClientStreamPtr st,
VIR_DEBUG("st=%p client=%p data=%p nbytes=%zu nonblock=%d flags=%x",
st, client, data, nbytes, nonblock, flags);
- virCheckFlags(0, -1);
+ virCheckFlags(VIR_STREAM_RECV_STOP_AT_HOLE, -1);
virObjectLock(st);
@@ -531,6 +531,13 @@ int virNetClientStreamRecvPacket(virNetClientStreamPtr st,
/* Pretend holeLength zeroes was read from stream. */
size_t len = want;
+ /* Yes, pretend unless we are asked not to. */
+ if (flags & VIR_STREAM_RECV_STOP_AT_HOLE) {
+ /* No error reporting here. Caller knows what they are doing. */
+ rv = -3;
+ goto cleanup;
+ }
+
if (len > st->holeLength)
len = st->holeLength;
--
2.13.0