xiaoxiang781216 commented on code in PR #1623:
URL: https://github.com/apache/nuttx-apps/pull/1623#discussion_r1181209653
##########
examples/ustream/ustream_server.c:
##########
@@ -60,7 +60,7 @@ int main(int argc, FAR char *argv[])
/* Allocate a BIG buffer */
- buffer = (char*)malloc(2*SENDSIZE);
+ buffer = (char *)malloc(2 * SENDSIZE);
Review Comment:
Since the whole file doesn't add FAR, I prefer to not add FAR. If you like,
please add all FAR with new patch.
##########
examples/ustream/ustream_server.c:
##########
@@ -78,18 +78,18 @@ int main(int argc, FAR char *argv[])
/* Bind the socket to a local address */
- addrlen = strlen(CONFIG_EXAMPLES_USTREAM_ADDR);
- if (addrlen > UNIX_PATH_MAX - 1)
+ addrlen = strlen(CONFIG_EXAMPLES_USTREAM_ADDR) + 1;
+ if (addrlen > UNIX_PATH_MAX)
{
- addrlen = UNIX_PATH_MAX - 1;
+ addrlen = UNIX_PATH_MAX;
}
myaddr.sun_family = AF_LOCAL;
- strncpy(myaddr.sun_path, CONFIG_EXAMPLES_USTREAM_ADDR, addrlen);
+ strlcpy(myaddr.sun_path, CONFIG_EXAMPLES_USTREAM_ADDR, addrlen);
myaddr.sun_path[addrlen] = '\0';
addrlen += sizeof(sa_family_t) + 1;
- ret = bind(listensd, (struct sockaddr*)&myaddr, addrlen);
+ ret = bind(listensd, (struct sockaddr *)&myaddr, addrlen);
Review Comment:
Since the whole file doesn't add FAR, I prefer to not add FAR. If you like,
please add all FAR with new patch.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]