Ensure errno is valid when returning from lxcContainerWaitForContinue

Only some of the return paths of lxcContainerWaitForContinue will
have set errno. In other paths we need to set it manually to avoid
the caller getting a random stale errno value

* src/lxc/lxc_container.c: Set errno in lxcContainerWaitForContinue
This commit is contained in:
Daniel P. Berrange 2011-11-01 12:28:26 +00:00
parent f33b5792f7
commit 065ecf5162

View File

@ -224,8 +224,13 @@ int lxcContainerWaitForContinue(int control)
int readLen;
readLen = saferead(control, &msg, sizeof(msg));
if (readLen != sizeof(msg) ||
msg != LXC_CONTINUE_MSG) {
if (readLen != sizeof(msg)) {
if (readLen >= 0)
errno = EIO;
return -1;
}
if (msg != LXC_CONTINUE_MSG) {
errno = EINVAL;
return -1;
}