]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
fdstreamtest: Print more info on read failure
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 11 Apr 2017 07:51:41 +0000 (09:51 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 28 Apr 2017 12:17:10 +0000 (14:17 +0200)
It helps with debugging if we know what's the return value of
saferead().

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
tests/fdstreamtest.c

index 5e82daccfeab12c8a5ea7b86e27f6b27cd5098f4..68a5bc354dd392c92f0e8d028e562a780ae0008e 100644 (file)
@@ -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;
         }