doc: pipes: Fix the pipe read example.
Replaces sizeof(header) which is equal to the size of the pointer, by sizeof (*header), which is equal to the size of struct message_header. Signed-off-by: Andrej Butok <andrey.butok@nxp.com>
This commit is contained in:
parent
bad87f1684
commit
3fab7624eb
1 changed files with 3 additions and 3 deletions
|
@ -150,12 +150,12 @@ process data items generated by one or more producing threads.
|
|||
|
||||
while (1) {
|
||||
rc = k_pipe_get(&my_pipe, buffer, sizeof(buffer), &bytes_read,
|
||||
sizeof(header), K_MSEC(100));
|
||||
sizeof(*header), K_MSEC(100));
|
||||
|
||||
if ((rc < 0) || (bytes_read < sizeof (header))) {
|
||||
if ((rc < 0) || (bytes_read < sizeof (*header))) {
|
||||
/* Incomplete message header received */
|
||||
...
|
||||
} else if (header->num_data_bytes + sizeof(header) > bytes_read) {
|
||||
} else if (header->num_data_bytes + sizeof(*header) > bytes_read) {
|
||||
/* Only some data was received */
|
||||
...
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue