From: zab Date: Wed, 22 Oct 2003 17:56:54 +0000 (+0000) Subject: - trivial bugs in the write_*.c race tests. use vprintf() to print va_list X-Git-Tag: v1_7_0_51~2^7~359 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=67d2827e310571b0a1ff4c967a9799a6b7746de2;p=fs%2Flustre-release.git - trivial bugs in the write_*.c race tests. use vprintf() to print va_list arguments and proprely check open()s result for errors. --- diff --git a/lustre/tests/write_append_truncate.c b/lustre/tests/write_append_truncate.c index 4df4666..30a95e5 100644 --- a/lustre/tests/write_append_truncate.c +++ b/lustre/tests/write_append_truncate.c @@ -57,7 +57,7 @@ int rprintf(int rank, int loop, const char *fmt, ...) va_start(ap, fmt); - printf(fmt, ap); + vprintf(fmt, ap); MPI_Finalize(); exit(1); @@ -118,7 +118,7 @@ int main(int argc, char *argv[]) if (rank == 0) { fd = open(fname, O_WRONLY|O_CREAT|O_TRUNC, 0666); - if (fd <= 0) + if (fd < 0) rprintf(0, -1, "create %s failed: %s\n", fname, strerror(errno)); printf("using %s\n", fname); @@ -128,7 +128,7 @@ int main(int argc, char *argv[]) rprintf(rank, -1, "prep MPI_Barrier failed: %d\n", error); fd = open(fname, O_RDWR | O_APPEND); - if (fd <= 0) + if (fd < 0) rprintf(rank, -1, "open %s failed: %s\n",fname,strerror(errno)); for (n = 0; n < nloops; n++) { diff --git a/lustre/tests/write_disjoint.c b/lustre/tests/write_disjoint.c index 1969f3b..16774c8 100644 --- a/lustre/tests/write_disjoint.c +++ b/lustre/tests/write_disjoint.c @@ -36,7 +36,7 @@ int rprintf(int rank, int loop, const char *fmt, ...) va_start(ap, fmt); - printf(fmt, ap); + vprintf(fmt, ap); MPI_Finalize(); exit(1); @@ -64,14 +64,14 @@ int main (int argc, char *argv[]) { if (rank == 0) { fd = open(FILENAME, O_WRONLY|O_CREAT|O_TRUNC, 0666); - if (fd == 0) + if (fd < 0) rprintf(rank, -1, "open() returned %s\n", strerror(errno)); } MPI_Barrier(MPI_COMM_WORLD); fd = open(FILENAME, O_RDWR); - if (fd == 0) + if (fd < 0) rprintf(rank, -1, "open() returned %s\n", strerror(errno)); for (n=0; n < 1000 ; n++) {