libxc: Report a better error on state file EOF. If a EOF is detected in state file 4 error are reported - 0-length - read_exact_timed failed - Error when reading batch size (0 = Success) - Error when reading batch (0 = Success) With this patch just one error is reported - Error when reading batch size (32 = Broken pipe) Signed-off-by: Frediano Ziglio <frediano.ziglio@citrix.com> # HG changeset patch # Parent 4bd752a4cdf323c41c50f8cd6286f566d67adeae diff -r 4bd752a4cdf3 -r beb5ec839f95 tools/libxc/xc_domain_restore.c --- a/tools/libxc/xc_domain_restore.c Fri Mar 23 20:51:48 2012 +0000 +++ b/tools/libxc/xc_domain_restore.c Tue Mar 27 15:13:10 2012 +0100 @@ -86,8 +86,8 @@ static ssize_t rdexact(xc_interface *xch if ( (len == -1) && ((errno == EINTR) || (errno == EAGAIN)) ) continue; if ( len == 0 ) { - ERROR("0-length read"); - errno = 0; + errno = EPIPE; + return -1; } if ( len <= 0 ) { ERROR("read_exact_timed failed (read rc: %d, errno: %d)", len, errno); @@ -1479,7 +1479,7 @@ int xc_domain_restore(xc_interface *xch, pagebuf.nr_physpages = pagebuf.nr_pages = 0; pagebuf.compbuf_pos = pagebuf.compbuf_size = 0; if ( pagebuf_get_one(xch, ctx, &pagebuf, io_fd, dom) < 0 ) { - PERROR("Error when reading batch"); + /* pagebuf_get_one already returned a proper error */ goto out; } } _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel