return;
}
+ if (fdst->threadErr)
+ events |= VIR_STREAM_EVENT_ERROR;
+
cb = fdst->cb;
cbopaque = fdst->opaque;
ff = fdst->ff;
if (fdst->thread) {
char *buf;
- if (fdst->threadQuit) {
+ if (fdst->threadQuit || fdst->threadErr) {
virReportSystemError(EBADF, "%s",
_("cannot write to stream"));
- return -1;
+ goto cleanup;
}
if (VIR_ALLOC(msg) < 0 ||
virFDStreamMsgPtr msg = NULL;
while (!(msg = fdst->msg)) {
- if (fdst->threadQuit) {
+ if (fdst->threadQuit || fdst->threadErr) {
if (nbytes) {
virReportSystemError(EBADF, "%s",
_("stream is not open"));
* the thread to do the lseek() for us. Under no
* circumstances we can do the lseek() ourselves here. We
* might mess up file position for the thread. */
+
+ if (fdst->threadQuit || fdst->threadErr) {
+ virReportSystemError(EBADF, "%s",
+ _("stream is not open"));
+ goto cleanup;
+ }
+
if (fdst->threadDoRead) {
msg = fdst->msg;
if (msg->type != VIR_FDSTREAM_MSG_TYPE_HOLE) {
if (fdst->thread) {
virFDStreamMsgPtr msg;
+ if (fdst->threadErr)
+ goto cleanup;
+
while (!(msg = fdst->msg)) {
if (fdst->threadQuit) {
*inData = *length = 0;