Attention is currently required from: pespin. neels has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/26608 )
Change subject: add osmo_sockaddr_to_str_c(), osmo_sockaddr_to_str_buf2() ......................................................................
Patch Set 2:
(6 comments)
Patchset:
PS2: the function was defined to return null for short buf. The new version is better, it returns a truncated string and the would-be-required length.
File src/socket.c:
https://gerrit.osmocom.org/c/libosmocore/+/26608/comment/6efb1de2_9815eff3 PS1, Line 1827: /*! string-format a given osmo_sockaddr address into a user-supplied buffer.
I think you are changing how this function used to worked here, and imho it's unexpected. […]
Previously, the function would return NULL in case of errors, just in a specific corner case it didn't. Read the API doc: "or NULL if too short". The C test shows this.
File tests/socket/socket_test.c:
https://gerrit.osmocom.org/c/libosmocore/+/26608/comment/4d53c597_41a7e44d PS2, Line 350: OSMO_ASSERT(!strncmp("[::1]:4", result, sizeof(buf))); here for some reason, even though the port number should be 42, the function failed to return NULL.
https://gerrit.osmocom.org/c/libosmocore/+/26608/comment/7d6b93bc_a59aebae PS2, Line 350: OSMO_ASSERT(result == NULL); Now this corner case is fixed.
https://gerrit.osmocom.org/c/libosmocore/+/26608/comment/877da413_f3e9b34f PS2, Line 357: OSMO_ASSERT(result == NULL); here and
https://gerrit.osmocom.org/c/libosmocore/+/26608/comment/5c7fc121_72005a9d PS2, Line 363: OSMO_ASSERT(result == NULL); here it was always verified to return NULL for a short buffer