]> git.proxmox.com Git - mirror_lxc.git/commit
Use actual length of socket's name for abstract sockets (v3)
authorS.Çağlar Onur <caglar@10ur.org>
Fri, 25 Oct 2013 22:04:52 +0000 (18:04 -0400)
committerSerge Hallyn <serge.hallyn@ubuntu.com>
Fri, 25 Oct 2013 21:15:23 +0000 (16:15 -0500)
commitaae93dd3dd20dd12c6b8f9f0490e2fb877ee3f09
treedb3a5fe8b8902b43ea734a8bacf868a82dad3915
parent9c88ff1f95eea1e1b2c06c22fcc09c5cb94bd270
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
[...]
000000000000000000000003 00000000 00000000 0001 03 226548 @lxc/ad055575fe28ddd5//var/lib/lxc^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@
[...]

with this patch;

cat /proc/net/unix | grep lxc
[...]
000000000000000000000002 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>
src/lxc/af_unix.c
src/lxc/af_unix.h
src/lxc/commands.c
src/lxc/lxc_monitord.c
src/lxc/monitor.c