Whamcloud - gitweb
- trivial bugs in the write_*.c race tests. use vprintf() to print va_list
authorzab <zab>
Wed, 22 Oct 2003 17:56:54 +0000 (17:56 +0000)
committerzab <zab>
Wed, 22 Oct 2003 17:56:54 +0000 (17:56 +0000)
  arguments and proprely check open()s result for errors.

lustre/tests/write_append_truncate.c
lustre/tests/write_disjoint.c

index 4df4666..30a95e5 100644 (file)
@@ -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++) {
index 1969f3b..16774c8 100644 (file)
@@ -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++) {