[FIX] Writer: discarded events counting
authorAlexander Aksenov <a.aksenov@samsung.com>
Mon, 29 Jun 2015 16:04:11 +0000 (19:04 +0300)
committerDmitry Kovalenko <d.kovalenko@samsung.com>
Thu, 2 Jul 2015 10:01:56 +0000 (03:01 -0700)
Change-Id: I3d4553da9cd50ebd8300a917d37d94e29bf2fcc2
Signed-off-by: Alexander Aksenov <a.aksenov@samsung.com>
writer/swap_msg.c

index 85a7c60..7f496ba 100644 (file)
@@ -126,7 +126,8 @@ int swap_msg_flush(struct swap_msg *m, size_t size)
 
        m->len = size;
 
-       if (swap_buffer_write(m, SWAP_MSG_PRIV_DATA + size)) {
+       if (swap_buffer_write(m, SWAP_MSG_PRIV_DATA + size) !=
+           (SWAP_MSG_PRIV_DATA + size)) {
                atomic_inc(&discarded);
                return -EINVAL;
        }
@@ -349,7 +350,7 @@ int swap_msg_raw(void *data, size_t size)
        m->seq_num = atomic_inc_return(&seq_num);
 
        /* TODO: What should be returned?! When message was discarded. */
-       if (swap_buffer_write(m, size))
+       if (swap_buffer_write(m, size) != size)
                atomic_inc(&discarded);
 
        return size;