util: skip incomplete ucred information in getpeersec()

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
util: add function getting proc environ

On the contrary of env, the added function returns all characters
cescaped, because it improves reproducibility.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
treewide: drop unnecessary trailing \n in log_*() calls

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
treewide: use log_*_errno whenever %m is in the format string

If the format string contains %m, clearly errno must have a meaningful
value, so we might as well use log_*_errno to have ERRNO= logged.

Using:
find . -name '*.[ch]' | xargs sed -r -i -e \
's/log_(debug|info|notice|warning|error|emergency)\((".*%m.*")/log_\1_errno(errno, \2/'

Plus some whitespace, linewrap, and indent adjustments.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>