virNetClientStreamPtr privst = st->privateData;
int rv;
- virCheckFlags(0, -1);
+ virCheckFlags(VIR_STREAM_RECV_STOP_AT_HOLE, -1);
if (virNetClientStreamRaiseError(privst))
return -1;
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);
/* 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;