net/net_cmsg.c: Fix warning about using void* arithmetics

utils/net_cmsg.c: In function 'cmsg_append':
utils/net_cmsg.c:82:23: error: pointer of type 'void *' used in arithmetic [-Werror=pointer-arith]
   82 |   msg->msg_control    += cmsgspace;
      |                       ^~
cc1: all warnings being treated as errors

Using void pointers in arithmetic operations is a GCC extension, it is
not supported by the standard. Because what is the size of a void ?
This commit is contained in:
Ville Juven 2023-05-10 09:41:39 +03:00 committed by Xiang Xiao
parent 3161005c40
commit 1e9560e1e5
1 changed files with 1 additions and 1 deletions

View File

@ -79,7 +79,7 @@ FAR void *cmsg_append(FAR struct msghdr *msg, int level, int type,
memcpy(cmsgdata, value, value_len); memcpy(cmsgdata, value, value_len);
} }
msg->msg_control += cmsgspace; msg->msg_control = (char *)msg->msg_control + cmsgspace;
msg->msg_controllen -= cmsgspace; msg->msg_controllen -= cmsgspace;
return cmsgdata; return cmsgdata;