From: Serge Hallyn Date: Mon, 11 Nov 2013 18:32:14 +0000 (-0600) Subject: lxc_abstract_unix_connect: accomodate containers started before Oct 28 X-Git-Tag: lxc-1.0.0.alpha3~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bdb3f44147bc1a55a97131b4b39d42844ae4fb9e;p=thirdparty%2Flxc.git lxc_abstract_unix_connect: accomodate containers started before Oct 28 commit aae93dd3dd20dd12c6b8f9f0490e2fb877ee3f09 fixed the command socket name to use the right pathlen instead of always passing in the max socket namelen. However, this breaks lxc-info/lxc-list/etc for containers started before that commit. So if the correct command sock name doesn't work, try the preexising one. Note we can probably undo this "after awhile". Maybe in august 2014. Signed-off-by: Serge Hallyn Acked-by: Stéphane Graber --- diff --git a/src/lxc/af_unix.c b/src/lxc/af_unix.c index ab73963e3..6f0183d95 100644 --- a/src/lxc/af_unix.c +++ b/src/lxc/af_unix.c @@ -135,6 +135,9 @@ int lxc_abstract_unix_connect(const char *path) if (connect(fd, (struct sockaddr *)&addr, offsetof(struct sockaddr_un, sun_path) + len)) { int tmp = errno; + /* special case to connect to older containers */ + if (connect(fd, (struct sockaddr *)&addr, sizeof(addr)) == 0) + return fd; process_lock(); close(fd); process_unlock();