Use actual length of socket's name for abstract sockets (v3)
The addrlen parameter should be the actual length of socket's name for abstract sockets. Otherwise socket gets padded with NULLs.
cat /proc/net/unix | grep lxc
[...]
0000000000000000:
00000003 00000000 00000000 0001 03 226548 @lxc/
ad055575fe28ddd5//var/lib/lxc^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@
[...]
with this patch;
cat /proc/net/unix | grep lxc
[...]
0000000000000000:
00000002 00000000 00010000 0001 01 109563 @lxc/
ad055575fe28ddd5//var/lib/lxc
[...]
Changes since v1:
* check the length of passed-in string
Changes since v2:
* remove non-abstract socket code path to simplify functions
* rename lxc_af_unix_* family to lxc_abstract_unix_*
Signed-off-by: S.Çağlar Onur <caglar@10ur.org>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>