[PATCH 02/38] fdstreamtest: Print more info on read failure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



It helps with debugging if we know what's the return value of
saferead().

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 tests/fdstreamtest.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/tests/fdstreamtest.c b/tests/fdstreamtest.c
index 5e82dac..68a5bc3 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;
         }
 
-- 
2.10.2

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux