Revision 185b4338 block/nbd.c

b/block/nbd.c
200 200
    if (rc >= 0 && iov) {
201 201
        ret = qemu_co_sendv(s->sock, iov, request->len, offset);
202 202
        if (ret != request->len) {
203
            errno = -EIO;
204
            rc = -1;
203
            return -EIO;
205 204
        }
206 205
    }
207 206
    qemu_aio_set_fd_handler(s->sock, nbd_reply_ready, NULL,
......
271 270
    if (ret < 0) {
272 271
        logout("Failed to negotiate with the NBD server\n");
273 272
        closesocket(sock);
274
        return -errno;
273
        return ret;
275 274
    }
276 275

  
277 276
    /* Now that we're connected, set the socket to be non-blocking and
......
340 339
    nbd_coroutine_start(s, &request);
341 340
    ret = nbd_co_send_request(s, &request, NULL, 0);
342 341
    if (ret < 0) {
343
        reply.error = errno;
342
        reply.error = -ret;
344 343
    } else {
345 344
        nbd_co_receive_reply(s, &request, &reply, qiov->iov, offset);
346 345
    }
......
369 368
    nbd_coroutine_start(s, &request);
370 369
    ret = nbd_co_send_request(s, &request, qiov->iov, offset);
371 370
    if (ret < 0) {
372
        reply.error = errno;
371
        reply.error = -ret;
373 372
    } else {
374 373
        nbd_co_receive_reply(s, &request, &reply, NULL, 0);
375 374
    }
......
437 436
    nbd_coroutine_start(s, &request);
438 437
    ret = nbd_co_send_request(s, &request, NULL, 0);
439 438
    if (ret < 0) {
440
        reply.error = errno;
439
        reply.error = -ret;
441 440
    } else {
442 441
        nbd_co_receive_reply(s, &request, &reply, NULL, 0);
443 442
    }
......
463 462
    nbd_coroutine_start(s, &request);
464 463
    ret = nbd_co_send_request(s, &request, NULL, 0);
465 464
    if (ret < 0) {
466
        reply.error = errno;
465
        reply.error = -ret;
467 466
    } else {
468 467
        nbd_co_receive_reply(s, &request, &reply, NULL, 0);
469 468
    }

Also available in: Unified diff