Subject: re: Strange behavious of getpeername(2) on pipe
To: None <mjl@emsi.priv.at, mrg@eterna.com.au>
From: Noriyuki Soda <soda@sra.co.jp>
List: tech-kern
Date: 03/27/2001 21:01:42
> note that in NetBSD, pipe() is really a frontend for socketpair(), so
> the fd's you get back from pipe are really sockets. this is why the
> getpeername() is able to succeed. (FWIW, the sockaddr_in.sin_addr
> for these results is 0.)
It is better to use sockaddr_un.sun_path rather than sockaddr_in.sin_addr,
because the address family (sockaddr.sa_family) which is returned from
getpeername(2) is AF_UNIX (a.k.a. AF_LOCAL) rather than AF_INET.
Also it is better to use "struct sockaddr_storage" for getpeername(2)
storage.
--
soda