conftest: fix transposed size and count arguments to fwrite.

* tests/conftest.c: Include <string.h> and <errno.h>.
Also include strerror in diagnostic.


Author: Jim Meyering <meyering@redhat.com>
This commit is contained in:
Jim Meyering 2007-11-12 22:16:25 +00:00
parent 92c8d7dd97
commit a8b9c6640a
2 changed files with 10 additions and 2 deletions

View File

@ -1,3 +1,9 @@
Mon Nov 12 23:11:35 CET 2007 Jim Meyering <meyering@redhat.com>
conftest: fix transposed size and count arguments to fwrite.
* tests/conftest.c: Include <string.h> and <errno.h>.
Also include strerror in diagnostic.
Mon Nov 12 14:56:33 CET 2007 Daniel Veillard <veillard@redhat.com>
Begin fixing uses of strtol: parse integers more carefully.

View File

@ -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);