In serial mode, return failure if the other end closes the connection

before we see SERIAL_MAGIC in the reply or timeout.

Signed-off-by: Ryan McCabe <rmccabe@redhat.com>
This commit is contained in:
Ryan McCabe 2012-05-16 09:15:42 -04:00
parent 2f87331c1a
commit 52381ce2b7

View File

@ -283,6 +283,9 @@ serial_fence_virt(fence_virt_args_t *args)
if (wait_for(fd, (const char *)&resp.magic,
sizeof(resp.magic), &tv) == 0) {
ret = _read_retry(fd, &resp.response, sizeof(resp.response), &tv);
} else {
/* The other end died or closed the connection */
return -1;
}
swab_serial_resp_t(&resp);