chiark / gitweb /
socket-util: slight rework of getpeersec()
authorLennart Poettering <lennart@poettering.net>
Sat, 30 Dec 2017 14:15:44 +0000 (15:15 +0100)
committerSven Eden <yamakuzure@gmx.net>
Wed, 30 May 2018 05:49:53 +0000 (07:49 +0200)
commitdafc98aaa282126d5a6061eb50d84308332d7806
tree41acce8438b3816111dd49ac7d3413d216e4d3eb
parent4b76c3ea45385ec87622844cc498e12dbeb252bd
socket-util: slight rework of getpeersec()

Let's call getsockopt() in a loop, so that we can deal correctly with
the label changing while we are trying to read it.

(also, while we are at it, let's make sure that there's always one
trailing NUL byte at the end of the buffer, after all SO_PEERSEC has
zero documentation, and multiple implementing backends, hence let's
better be safe than sorry)
src/basic/socket-util.c