Re: [PATCH spice 1/3] char_device: Properly update buffer status when leaving the write loop on stop

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ack series

On 03/29/2013 05:11 AM, Hans de Goede wrote:
Before this patch the write-loop in spice_char_device_write_to_device would
break on running becoming 0, after having written some data, without updating
the buffer status, causing the same data to be written *again* when started.

Signed-off-by: Hans de Goede <hdegoede@xxxxxxxxxx>
---
  server/char_device.c | 5 +----
  1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/server/char_device.c b/server/char_device.c
index e07eda1..368c9bc 100644
--- a/server/char_device.c
+++ b/server/char_device.c
@@ -438,7 +438,7 @@ static int spice_char_device_write_to_device(SpiceCharDeviceState *dev)
      core->timer_cancel(dev->write_to_dev_timer);

      sif = SPICE_CONTAINEROF(dev->sin->base.sif, SpiceCharDeviceInterface, base);
-    while (1) {
+    while (dev->running) {
          uint32_t write_len;

          if (!dev->cur_write_buf) {
@@ -454,9 +454,6 @@ static int spice_char_device_write_to_device(SpiceCharDeviceState *dev)
          write_len = dev->cur_write_buf->buf + dev->cur_write_buf->buf_used -
                      dev->cur_write_buf_pos;
          n = sif->write(dev->sin, dev->cur_write_buf_pos, write_len);
-        if (!dev->running) {
-            break;
-        }
          if (n <= 0) {
              break;
          }


_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]