[Xenomai-git] Philippe Gerum : alchemy/queue: allow zero-size message with rt_queue_write()
Module: xenomai-3 Branch: wip/dovetail Commit: 32c7bdc249f48122fc2a15cade98fdfffad04cf4 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=32c7bdc249f48122fc2a15cade98fdfffad04cf4 Author: Philippe GerumDate: 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
[Xenomai-git] Philippe Gerum : alchemy/queue: allow zero-size message with rt_queue_write()
Module: xenomai-3 Branch: next Commit: 32c7bdc249f48122fc2a15cade98fdfffad04cf4 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=32c7bdc249f48122fc2a15cade98fdfffad04cf4 Author: Philippe GerumDate: 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
[Xenomai-git] Philippe Gerum : alchemy/queue: allow zero-size message with rt_queue_write()
Module: xenomai-3 Branch: stable-3.0.x Commit: bbc4c122c84b9be558809915190d04bb3b56f07e URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=bbc4c122c84b9be558809915190d04bb3b56f07e Author: Philippe GerumDate: 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 9c88018..3a45257 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