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

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

On Mon, Nov 12, 2007 at 10:57:50PM +0100, Jim Meyering wrote:
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. [...] - 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));
Good catch, +1 ! Daniel -- Red Hat Virtualization group http://redhat.com/virtualization/ Daniel Veillard | virtualization library http://libvirt.org/ veillard@redhat.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/

Daniel Veillard <veillard@redhat.com> wrote:
On Mon, Nov 12, 2007 at 10:57:50PM +0100, Jim Meyering wrote:
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. [...] - 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));
Good catch, +1 !
Thanks. Committed.
participants (2)
-
Daniel Veillard
-
Jim Meyering