From 049f6b9baac3d0d1a164e058b216ff168b692e2f Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Mon, 5 Nov 2007 17:10:26 +0000 Subject: [PATCH] Properly pass third argument to open() in fsync test program. Hiroshi Saito --- src/tools/fsync/test_fsync.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/tools/fsync/test_fsync.c b/src/tools/fsync/test_fsync.c index 2179ac937e..ef5cbf4023 100644 --- a/src/tools/fsync/test_fsync.c +++ b/src/tools/fsync/test_fsync.c @@ -72,7 +72,7 @@ main(int argc, char *argv[]) gettimeofday(&start_t, NULL); for (i = 0; i < loops; i++) { - if ((tmpfile = open(filename, O_RDWR)) == -1) + if ((tmpfile = open(filename, O_RDWR, 0)) == -1) die("Cannot open output file."); if (write(tmpfile, buf, WRITE_SIZE/2) != WRITE_SIZE/2) die("write failed"); @@ -90,14 +90,14 @@ main(int argc, char *argv[]) gettimeofday(&start_t, NULL); for (i = 0; i < loops; i++) { - if ((tmpfile = open(filename, O_RDWR)) == -1) + if ((tmpfile = open(filename, O_RDWR, 0)) == -1) die("Cannot open output file."); if (write(tmpfile, buf, WRITE_SIZE/2) != WRITE_SIZE/2) die("write failed"); if (fsync(tmpfile) != 0) die("fsync failed"); close(tmpfile); - if ((tmpfile = open(filename, O_RDWR)) == -1) + if ((tmpfile = open(filename, O_RDWR, 0)) == -1) die("Cannot open output file."); /* do nothing but the open/close the tests are consistent. */ close(tmpfile); @@ -111,13 +111,13 @@ main(int argc, char *argv[]) gettimeofday(&start_t, NULL); for (i = 0; i < loops; i++) { - if ((tmpfile = open(filename, O_RDWR)) == -1) + if ((tmpfile = open(filename, O_RDWR, 0)) == -1) die("Cannot open output file."); if (write(tmpfile, buf, WRITE_SIZE/2) != WRITE_SIZE/2) die("write failed"); close(tmpfile); /* reopen file */ - if ((tmpfile = open(filename, O_RDWR)) == -1) + if ((tmpfile = open(filename, O_RDWR, 0)) == -1) die("Cannot open output file."); if (fsync(tmpfile) != 0) die("fsync failed"); @@ -132,7 +132,7 @@ main(int argc, char *argv[]) #ifdef OPEN_SYNC_FLAG /* 16k o_sync write */ - if ((tmpfile = open(filename, O_RDWR | OPEN_SYNC_FLAG)) == -1) + if ((tmpfile = open(filename, O_RDWR | OPEN_SYNC_FLAG, 0)) == -1) die("Cannot open output file."); gettimeofday(&start_t, NULL); for (i = 0; i < loops; i++) @@ -145,7 +145,7 @@ main(int argc, char *argv[]) printf("\n"); /* 2*8k o_sync writes */ - if ((tmpfile = open(filename, O_RDWR | OPEN_SYNC_FLAG)) == -1) + if ((tmpfile = open(filename, O_RDWR | OPEN_SYNC_FLAG, 0)) == -1) die("Cannot open output file."); gettimeofday(&start_t, NULL); for (i = 0; i < loops; i++) @@ -169,7 +169,7 @@ main(int argc, char *argv[]) #ifdef OPEN_DATASYNC_FLAG /* open_dsync, write */ - if ((tmpfile = open(filename, O_RDWR | O_DSYNC)) == -1) + if ((tmpfile = open(filename, O_RDWR | O_DSYNC, 0)) == -1) die("Cannot open output file."); gettimeofday(&start_t, NULL); for (i = 0; i < loops; i++) @@ -182,7 +182,7 @@ main(int argc, char *argv[]) printf("\n"); #ifdef OPEN_SYNC_FLAG /* open_fsync, write */ - if ((tmpfile = open(filename, O_RDWR | OPEN_SYNC_FLAG)) == -1) + if ((tmpfile = open(filename, O_RDWR | OPEN_SYNC_FLAG, 0)) == -1) die("Cannot open output file."); gettimeofday(&start_t, NULL); for (i = 0; i < loops; i++) @@ -200,7 +200,7 @@ main(int argc, char *argv[]) #ifdef HAVE_FDATASYNC /* write, fdatasync */ - if ((tmpfile = open(filename, O_RDWR)) == -1) + if ((tmpfile = open(filename, O_RDWR, 0)) == -1) die("Cannot open output file."); gettimeofday(&start_t, NULL); for (i = 0; i < loops; i++) @@ -219,7 +219,7 @@ main(int argc, char *argv[]) printf("\n"); /* write, fsync, close */ - if ((tmpfile = open(filename, O_RDWR)) == -1) + if ((tmpfile = open(filename, O_RDWR, 0)) == -1) die("Cannot open output file."); gettimeofday(&start_t, NULL); for (i = 0; i < loops; i++) @@ -239,7 +239,7 @@ main(int argc, char *argv[]) #ifdef OPEN_DATASYNC_FLAG /* open_dsync, write */ - if ((tmpfile = open(filename, O_RDWR | O_DSYNC)) == -1) + if ((tmpfile = open(filename, O_RDWR | O_DSYNC, 0)) == -1) die("Cannot open output file."); gettimeofday(&start_t, NULL); for (i = 0; i < loops; i++) @@ -260,7 +260,7 @@ main(int argc, char *argv[]) #ifdef OPEN_SYNC_FLAG /* open_fsync, write */ - if ((tmpfile = open(filename, O_RDWR | OPEN_SYNC_FLAG)) == -1) + if ((tmpfile = open(filename, O_RDWR | OPEN_SYNC_FLAG, 0)) == -1) die("Cannot open output file."); gettimeofday(&start_t, NULL); for (i = 0; i < loops; i++) @@ -279,7 +279,7 @@ main(int argc, char *argv[]) #ifdef HAVE_FDATASYNC /* write, fdatasync */ - if ((tmpfile = open(filename, O_RDWR)) == -1) + if ((tmpfile = open(filename, O_RDWR, 0)) == -1) die("Cannot open output file."); gettimeofday(&start_t, NULL); for (i = 0; i < loops; i++) @@ -300,7 +300,7 @@ main(int argc, char *argv[]) printf("\n"); /* write, fsync, close */ - if ((tmpfile = open(filename, O_RDWR)) == -1) + if ((tmpfile = open(filename, O_RDWR, 0)) == -1) die("Cannot open output file."); gettimeofday(&start_t, NULL); for (i = 0; i < loops; i++) -- 2.40.0