From: Michal Privoznik Date: Tue, 11 Apr 2017 07:51:41 +0000 (+0200) Subject: fdstreamtest: Print more info on read failure X-Git-Tag: v3.3.0-rc1~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b8ef4758f362911c707bbcacedd76ca075ab932f;p=thirdparty%2Flibvirt.git fdstreamtest: Print more info on read failure It helps with debugging if we know what's the return value of saferead(). Signed-off-by: Michal Privoznik Reviewed-by: John Ferlan --- diff --git a/tests/fdstreamtest.c b/tests/fdstreamtest.c index 5e82daccfe..68a5bc354d 100644 --- a/tests/fdstreamtest.c +++ b/tests/fdstreamtest.c @@ -250,14 +250,16 @@ static int testFDStreamWriteCommon(const char *scratchdir, bool blocking) goto cleanup; for (i = 0; i < 10; i++) { - size_t want; + size_t want, got; if (i == 9) want = PATTERN_LEN / 2; else want = PATTERN_LEN; - if (saferead(fd, buf, want) != want) { - virFilePrintf(stderr, "Short read from data\n"); + if ((got = saferead(fd, buf, want)) != want) { + virFilePrintf(stderr, + "Short read from data, i=%zu got=%zu want=%zu\n", + i, got, want); goto cleanup; }