[Libvir] [PATCH] conftest: fix transposed size and count arguments to fwrite.

Jim Meyering jim at meyering.net
Mon Nov 12 21:57:50 UTC 2007


I noticed conftest fail and tracked it down to this:

	conftest: fix transposed size and count arguments to fwrite.
	* tests/conftest.c: Include <string.h> and <errno.h>.
	  Also include strerror in diagnostic.

---
 tests/conftest.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/tests/conftest.c b/tests/conftest.c
index 604e410..9c8e3a6 100644
--- a/tests/conftest.c
+++ b/tests/conftest.c
@@ -1,6 +1,8 @@
 #include <unistd.h>
 #include <stdlib.h>
 #include <stdio.h>
+#include <string.h>
+#include <errno.h>
 #include "conf.h"

 int main(int argc, char **argv) {
@@ -25,8 +27,8 @@ int main(int argc, char **argv) {
 	exit(3);
     }
     virConfFree(conf);
-    if (fwrite(buffer, len, 1, stdout) != len) {
-        fprintf(stderr, "Write failed\n");
+    if (fwrite(buffer, 1, len, stdout) != len) {
+	fprintf(stderr, "Write failed: %s\n", strerror (errno));
 	exit(1);
     }
     exit(0);
--
1.5.3.5.643.g40e25




More information about the libvir-list mailing list