You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/08/01 09:58:27 UTC

[GitHub] [incubator-nuttx] pkarashchenko commented on a diff in pull request #6751: Net thread-safe ether_ntoa_r & inet_ntoa_r

pkarashchenko commented on code in PR #6751:
URL: https://github.com/apache/incubator-nuttx/pull/6751#discussion_r934349909


##########
drivers/wireless/gs2200m.c:
##########
@@ -2018,7 +2018,9 @@ static enum pkt_type_e gs2200m_send_bulk(FAR struct gs2200m_dev_s *dev,
     }
   else
     {
-      wlinfo("** addr=%s port=%d\n", inet_ntoa(msg->addr.sin_addr),
+      char inetaddr[INET_ADDRSTRLEN + 2];
+
+      wlinfo("** addr=%s port=%d\n", inet_ntoa(msg->addr.sin_addr, inetaddr),

Review Comment:
   ```suggestion
         wlinfo("** addr=%s port=%d\n", inet_ntoa_r(msg->addr.sin_addr, inetaddr),
   ```



##########
include/arpa/inet.h:
##########
@@ -50,6 +50,7 @@ in_addr_t   inet_addr(FAR const char *cp);
 in_addr_t   inet_network(FAR const char *cp);
 
 FAR char   *inet_ntoa(struct in_addr in);
+FAR char   *inet_ntoa_r(struct in_addr in, FAR char *buf);

Review Comment:
   most of the variants that I lookup in the Internet give me `char * inet_ntoa_r(struct in_addr in, char *buf, socklen_t size);`, so why `size` is not added in this variant?



##########
drivers/wireless/gs2200m.c:
##########
@@ -2027,7 +2029,8 @@ static enum pkt_type_e gs2200m_send_bulk(FAR struct gs2200m_dev_s *dev,
 
       snprintf(cmd, sizeof(cmd), "%cY%c%s:%d:%s",
                ASCII_ESC, msg->cid,
-               inet_ntoa(msg->addr.sin_addr), NTOHS(msg->addr.sin_port),
+               inet_ntoa(msg->addr.sin_addr, inetaddr),

Review Comment:
   ```suggestion
                  inet_ntoa_r(msg->addr.sin_addr, inetaddr),
   ```



-- 
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: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org