Module: xenomai-3
Branch: wip/dovetail
Commit: 32c7bdc249f48122fc2a15cade98fdfffad04cf4
URL:    
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=32c7bdc249f48122fc2a15cade98fdfffad04cf4

Author: Philippe Gerum <r...@xenomai.org>
Date:   Sat Apr 30 17:41:18 2016 +0200

alchemy/queue: allow zero-size message with rt_queue_write()

---

 lib/alchemy/queue.c |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/lib/alchemy/queue.c b/lib/alchemy/queue.c
index 34a35f5..eb4bd19 100644
--- a/lib/alchemy/queue.c
+++ b/lib/alchemy/queue.c
@@ -630,10 +630,7 @@ int rt_queue_write(RT_QUEUE *queue,
        if (mode & ~(Q_URGENT|Q_BROADCAST))
                return -EINVAL;
 
-       if (size == 0)
-               return 0;
-
-       if (buf == NULL)
+       if (buf == NULL && size > 0)
                return -EINVAL;
 
        CANCEL_DEFER(svc);
@@ -683,7 +680,8 @@ enqueue:
 
        msg->size = size;
        msg->refcount = 0;
-       memcpy(msg + 1, buf, size);
+       if (size > 0)
+               memcpy(msg + 1, buf, size);
 
        ret = 0;  /* # of tasks unblocked. */
        if (nwaiters == 0) {


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git

Reply via email to