Project

General

Profile

Actions

Bug #6921

open

getsockname must have socklen_t as third argument instead of int

Added by Alexander Eremin over 6 years ago. Updated over 6 years ago.

Status:
Feedback
Priority:
Normal
Assignee:
-
Category:
-
Start date:
2016-04-19
Due date:
% Done:

0%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage
Gerrit CR:

Description

getsockname have an int* as third argument in various places. According to POSIX and SUS it should be replaced with the socklen_t

Actions #1

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.

Actions #2

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

Actions

Also available in: Atom PDF