[Spice-devel] [Xspice PATCH 06/11] vmc_read: rename variable "read" to "nbytes"

Uri Lublin uril at redhat.com
Mon Jan 26 02:35:38 PST 2015


This fixes the following compiler warning.
spiceqxl_vdagent.c:49: warning: declaration of ‘read’ shadows a global declaration
/usr/include/unistd.h:357: warning: shadowed declaration is here
---
 src/spiceqxl_vdagent.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/spiceqxl_vdagent.c b/src/spiceqxl_vdagent.c
index ba04cb8..4208233 100644
--- a/src/spiceqxl_vdagent.c
+++ b/src/spiceqxl_vdagent.c
@@ -46,13 +46,13 @@ static int vmc_write(SpiceCharDeviceInstance *sin, const uint8_t *buf, int len)
 
 static int vmc_read(SpiceCharDeviceInstance *sin, uint8_t *buf, int len)
 {
-    int read;
+    int nbytes;
 
     if (virtio_client_fd == -1) {
         return 0;
     }
-    read = recv(virtio_client_fd, buf, len, 0);
-    if (read <= 0) {
+    nbytes = recv(virtio_client_fd, buf, len, 0);
+    if (nbytes <= 0) {
         if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR) {
             return 0;
         }
@@ -62,7 +62,7 @@ static int vmc_read(SpiceCharDeviceInstance *sin, uint8_t *buf, int len)
         vdagent_sin.qxl->core->watch_remove(virtio_client_watch);
         virtio_client_watch = NULL;
     }
-    return read;
+    return nbytes;
 }
 
 static void on_read_available(int fd, int event, void *opaque)
-- 
1.7.1



More information about the Spice-devel mailing list