Skip to content

getsockname() breakage? AMD64_LINUX #1196

@dragisha

Description

@dragisha

I am trying to support some of my old code and along the way, I upgraded my system to d5.11.9

At the moment when my code invokes getsockname();

PROCEDURE getsockname (fd: INTEGER): IP.Endpoint =
  TYPE
    Addr = Uin.struct_sockaddr_in;
  VAR
    addr: Addr;
    endpoint: IP.Endpoint;
    len: Usocket.socklen_t := BYTESIZE (addr);
  BEGIN
    IF Usocket.getsockname (fd, ADR (addr), ADR (len)) >= 0 THEN

I get this:

../src/unix/Common/Usocket.c:253: SockAddrNativeToM3: Assertion family == AF_INET || family == AF_INET6 || family == AF_UNIX' failed.`

Usocket.c code:

static
int
SockAddrNativeToM3(const NativeSockAddrUnionAll* native, M3SockAddrUnionAll* m3)
{
    const unsigned family = native->in.sin_family;
#ifdef AF_UNIX
    printf("in.sin_family=%d\n", family);     
    assert(family == AF_INET || family == AF_INET6 || family == AF_UNIX);

family value is zero at this point.

Does this ring a bell to someone? What changed and what do I have to adjust to make this work?

TIA,
dragisha

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions