vhost-user: call set_msgfds unconditionally
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Tue, 26 Jul 2016 21:15:09 +0000 (01:15 +0400)
committerMichael S. Tsirkin <mst@redhat.com>
Thu, 28 Jul 2016 21:33:47 +0000 (00:33 +0300)
It is fine to call set_msgfds() with 0 fd, and ensures any previous fd
array is cleared.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hw/virtio/vhost-user.c

index 495e09fd4e42b7687fc9fc533501ea9f8e9125a3..f01b92f51271feac2e82e8370e12fb699fb2c560 100644 (file)
@@ -187,9 +187,7 @@ static int vhost_user_write(struct vhost_dev *dev, VhostUserMsg *msg,
         return 0;
     }
 
-    if (fd_num) {
-        qemu_chr_fe_set_msgfds(chr, fds, fd_num);
-    }
+    qemu_chr_fe_set_msgfds(chr, fds, fd_num);
 
     return qemu_chr_fe_write_all(chr, (const uint8_t *) msg, size) == size ?
             0 : -1;