]> git.ipfire.org Git - thirdparty/lxc.git/commit
monitor: fix sockname calculation for long lxcpaths
authorSerge Hallyn <serge.hallyn@ubuntu.com>
Sat, 9 Aug 2014 00:30:12 +0000 (00:30 +0000)
committerStéphane Graber <stgraber@ubuntu.com>
Mon, 18 Aug 2014 03:39:02 +0000 (23:39 -0400)
commit073135baa78511c26e502362840f2c950cfddfe2
tree7a5168f148444feb32f9a7efb0ce5a15d86a6ef7
parente85898415c28e0467aed3851541e70678ad1688e
monitor: fix sockname calculation for long lxcpaths

A long enough lxcpath (and small PATH_MAX through crappy defines) can cause
the creation of the string to be hashed to fail.  So just use alloca to
get the size string we need.

More importantly, while I can't explain it, if lxcpath is too long, setting
sockname[sizeof(addr->sun_path)-2] to \0 simply doesn't seem to work.  So set
sockname[sizeof(addr->sun_path)-3] to \0, which does work.

With this, and with

lxc.lxcpath = /opt/lxc0123456789/lxc0123456789/lxc0123456789/lxc0123456789/lxc0123456789/lxc0123456789/lxc0123456789/lxc0123456789/lxc0123456789/lxc0123456789

in /etc/lxc/lxc.conf, I can run lxc-wait just fine.  Without it, it fails
(as does lxc-start -d, which uses lxc_wait to verify the container started)

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
src/lxc/monitor.c