socket-util: slight rework of getpeersec()
authorLennart Poettering <lennart@poettering.net>
Sat, 30 Dec 2017 14:15:44 +0000 (15:15 +0100)
committerLennart Poettering <lennart@poettering.net>
Thu, 4 Jan 2018 12:28:24 +0000 (13:28 +0100)
commit217d89678269334f461e9abeeffed57077b21454
tree530f5b8752db250b44c669e24ded6945ec1bc52c
parentbbcc701ee7360c39d34aed33381803d44dc5da9f
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