]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
sync: fail on unexpected message sizes 1005/head
authorTycho Andersen <tycho.andersen@canonical.com>
Fri, 6 May 2016 16:21:39 +0000 (11:21 -0500)
committerTycho Andersen <tycho.andersen@canonical.com>
Fri, 6 May 2016 16:21:39 +0000 (11:21 -0500)
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 <tycho.andersen@canonical.com>
src/lxc/sync.c

index f06d302f7edbaa2696c6a36b96576038383470b7..82f68e36471e7b13cbdbe123691161215b05ac7a 100644 (file)
@@ -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);