Bug #6921
opengetsockname must have socklen_t as third argument instead of int
0%
Description
getsockname have an int* as third argument in various places. According to POSIX and SUS it should be replaced with the socklen_t
Updated by Garrett D'Amore over 6 years ago
- Status changed from New to Feedback
Uh, not sure what you're seeing: Here's what's in sys/socket.h:
```
#if defined(_XPG4_2) && !defined(_XPG5) && !defined(_LP64)
typedef size_t socklen_t;
#else
typedef uint32_t socklen_t;
#endif /* defined(_XPG4_2) && !defined(_XPG5) && !defined(_LP64) */
#if defined(_XPG4_2) || defined(_BOOT)
typedef socklen_t _RESTRICT_KYWD Psocklen_t;
#else
typedef void *_RESTRICT_KYWD Psocklen_t;
#endif / defined(_XPG4_2) || defined(_BOOT) */
```
```
extern int getsockname(int, struct sockaddr *_RESTRICT_KYWD, Psocklen_t);
```
Maybe you're looking libbc (the legacy BSD compatibility library -- that we really should just delete)?
If you want the right settings for POSIX, you need to use the right definitions to trigger _XPG4_2 or better to be applied.
Also, make sure you use -lxnet if you can.
Updated by Alexander Eremin over 6 years ago
Garrett D'Amore wrote:
Uh, not sure what you're seeing: Here's what's in sys/socket.h:
well, I mean such things like:
http://src.illumos.org/source/xref/illumos-gate/usr/src/cmd/cmd-inet/usr.lib/inetd/inetd.c#773