On 01/16/2014 06:16 PM, Daniel P. Berrange wrote:
On Wed, Jan 08, 2014 at 05:12:55PM +0800, Lei Li wrote:
Signed-off-by: Lei Li <li...@linux.vnet.ibm.com>
---
  hw/9pfs/virtio-9p-proxy.c |   60 ++------------------------------------------
  1 files changed, 3 insertions(+), 57 deletions(-)

diff --git a/hw/9pfs/virtio-9p-proxy.c b/hw/9pfs/virtio-9p-proxy.c
index 5f44bb7..f34b845 100644
--- a/hw/9pfs/virtio-9p-proxy.c
+++ b/hw/9pfs/virtio-9p-proxy.c
-    do {
-        retval = recvmsg(sockfd, &msg, 0);
-    } while (retval < 0 && errno == EINTR);
-    if (retval <= 0) {
-        return retval;
-    }
-    /*
-     * data is set to V9FS_FD_VALID, if ancillary data is sent.  If this
-     * request doesn't need ancillary data (fd) or an error occurred,
-     * data is set to negative errno value.
-     */
-    if (data != V9FS_FD_VALID) {
-        *status = data;
-        return 0;
-    }
This code is handling the 'data' value...


@@ -307,6 +252,7 @@ static int v9fs_request(V9fsProxy *proxy, int type,
      V9fsString *name, *value;
      V9fsString *path, *oldpath;
      struct iovec *iovec = NULL, *reply = NULL;
+    int data = V9FS_FD_VALID;
qemu_mutex_lock(&proxy->mutex); @@ -548,7 +494,7 @@ static int v9fs_request(V9fsProxy *proxy, int type,
           * A file descriptor is returned as response for
           * T_OPEN,T_CREATE on success
           */
-        if (v9fs_receivefd(proxy->sockfd, &retval) < 0) {
+        if (qemu_recv_with_fd(proxy->sockfd, &retval, &data, sizeof(data)) < 
0) {
              goto close_error;
          }
...but this code is ignoring the return value in 'data'.

It is not be ignored. The above logical is put into the common
method, like:

    if (data != *(int *)buf) {
        *passed_fd = data;
        return 0;
    }



Daniel


--
Lei


Reply via email to