Date: Thu, 15 Apr 2021 22:15:54 +0300 From: Konstantin Belousov <kostikbel@gmail.com> To: Gleb Popov <arrowd@freebsd.org> Cc: freebsd-hackers <freebsd-hackers@freebsd.org> Subject: Re: A bug with getsockopt(SOL_LOCAL, LOCAL_PEERCRED) ? Message-ID: <YHiQ6qEjS2w8uYpS@kib.kiev.ua> In-Reply-To: <CALH631kLCApctk4iQJj6br0Pzeb6qsh9g3jz_SA8hH91ftQGDQ@mail.gmail.com> References: <CALH631kLCApctk4iQJj6br0Pzeb6qsh9g3jz_SA8hH91ftQGDQ@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Apr 15, 2021 at 09:58:36PM +0300, Gleb Popov wrote: > Hello hackers. > > I'm using getsockopt(SOL_LOCAL, LOCAL_PEERCRED) on a unix socket and for > some reason it fails for me. I came up with a minimal reproduction > testcase: https://arrowd.name/un.cpp > > Steps to reproduce: > 1. c++ un.cpp > 2. ./a.out > 3. nc -U foobar > > This results in > > getsockopt > failed with > Socket is not connected > > Am I missing something? You are calling getsockopt(2) in the listen socket, not on the connected one. Replace s with s2 in the call.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?YHiQ6qEjS2w8uYpS>