From: Tycho Andersen Date: Fri, 6 May 2016 16:21:39 +0000 (-0500) Subject: sync: fail on unexpected message sizes X-Git-Tag: lxc-2.1.0~430^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F1005%2Fhead;p=thirdparty%2Flxc.git sync: fail on unexpected message sizes I think (?) this may be related to our hanging monitor bug. Let's do this anyway, as it's probably a good idea. Signed-off-by: Tycho Andersen --- diff --git a/src/lxc/sync.c b/src/lxc/sync.c index f06d302f7..82f68e364 100644 --- a/src/lxc/sync.c +++ b/src/lxc/sync.c @@ -47,6 +47,11 @@ static int __sync_wait(int fd, int sequence) if (!ret) return 0; + if (ret != sizeof(sync)) { + ERROR("unexpected sync size: %d expected %lu", ret, sizeof(sync)); + return -1; + } + if (sync == LXC_SYNC_ERROR) { ERROR("An error occurred in another process " "(expected sequence number %d)", sequence);