Error with socketpair and getsockname

Romick yellowrabbit2010 at gmail.com
Wed Aug 5 05:01:41 PDT 2015


On Wed, Aug 05, 2015 at 01:17:16PM +0200, Marco Righele wrote:
> 
>        len = sizeof(sa);
>        if (getsockname(fds[0], &sa, &len)) {
>            printf("getsockname error\n");
>            return 1;
>        }
>        assert( type == SOCK_STREAM );
>        assert( sa.sa_family == AF_UNIX );
>    }
> 
> Instead of AF_UNIX the call to getsockname returns AF_UNSET.
> Am I missing something ?
> 

check len before use any of sa's fields.


-- 
  with best reagrds, Yellow Rabbit
  DragonFly 4.3-DEVELOPMENT x86_64



More information about the Users mailing list