* hole: @data = false, @length > 0
* EOF: @data = false, @length = 0
*
- * Returns 0 on success,
+ * The position in the underlying stream should not be changed
+ * upon return from this function, e.g. position in the
+ * underlying file is kept the same. For streams where this
+ * condition is impossible to meet, the function can return 1 to
+ * signal this to a caller.
+ *
+ * Returns 0 on success (stream position unchanged),
+ * 1 on success (stream position changed),
* -1 otherwise
*/
int
msg = NULL;
- /* We have successfully sent stream skip to the other side.
- * To keep streams in sync seek locally too. */
- virStreamSendHole(stream->st, length, 0);
+ /* We have successfully sent stream skip to the other side. To
+ * keep streams in sync seek locally too (rv == 0), unless it's
+ * already done (rv == 1). */
+ if (rv == 0)
+ virStreamSendHole(stream->st, length, 0);
/* We're done with this call */
goto done;
}