Commit 69138a94 authored by Bruce Momjian's avatar Bruce Momjian

Add permission mode to opens().

parent bfaa9a0a
...@@ -39,7 +39,7 @@ int main(int argc, char *argv[]) ...@@ -39,7 +39,7 @@ int main(int argc, char *argv[])
printf("Simple write timing:\n"); printf("Simple write timing:\n");
/* write only */ /* write only */
gettimeofday(&start_t, NULL); gettimeofday(&start_t, NULL);
if ((tmpfile = open("/var/tmp/test_fsync.out", O_RDWR | O_CREAT)) == -1) if ((tmpfile = open("/var/tmp/test_fsync.out", O_RDWR | O_CREAT, 0600)) == -1)
die("can't open /var/tmp/test_fsync.out"); die("can't open /var/tmp/test_fsync.out");
write(tmpfile, &strout, 200); write(tmpfile, &strout, 200);
close(tmpfile); close(tmpfile);
...@@ -52,7 +52,7 @@ int main(int argc, char *argv[]) ...@@ -52,7 +52,7 @@ int main(int argc, char *argv[])
printf("Compare fsync before and after write's close:\n"); printf("Compare fsync before and after write's close:\n");
/* write, fsync, close */ /* write, fsync, close */
gettimeofday(&start_t, NULL); gettimeofday(&start_t, NULL);
if ((tmpfile = open("/var/tmp/test_fsync.out", O_RDWR | O_CREAT)) == -1) if ((tmpfile = open("/var/tmp/test_fsync.out", O_RDWR | O_CREAT, 0600)) == -1)
die("can't open /var/tmp/test_fsync.out"); die("can't open /var/tmp/test_fsync.out");
write(tmpfile, &strout, 200); write(tmpfile, &strout, 200);
fsync(tmpfile); fsync(tmpfile);
...@@ -65,12 +65,12 @@ int main(int argc, char *argv[]) ...@@ -65,12 +65,12 @@ int main(int argc, char *argv[])
/* write, close, fsync */ /* write, close, fsync */
gettimeofday(&start_t, NULL); gettimeofday(&start_t, NULL);
if ((tmpfile = open("/var/tmp/test_fsync.out", O_RDWR | O_CREAT)) == -1) if ((tmpfile = open("/var/tmp/test_fsync.out", O_RDWR | O_CREAT, 0600)) == -1)
die("can't open /var/tmp/test_fsync.out"); die("can't open /var/tmp/test_fsync.out");
write(tmpfile, &strout, 200); write(tmpfile, &strout, 200);
close(tmpfile); close(tmpfile);
/* reopen file */ /* reopen file */
if ((tmpfile = open("/var/tmp/test_fsync.out", O_RDWR | O_CREAT)) == -1) if ((tmpfile = open("/var/tmp/test_fsync.out", O_RDWR | O_CREAT, 0600)) == -1)
die("can't open /var/tmp/test_fsync.out"); die("can't open /var/tmp/test_fsync.out");
fsync(tmpfile); fsync(tmpfile);
close(tmpfile); close(tmpfile);
...@@ -85,7 +85,7 @@ int main(int argc, char *argv[]) ...@@ -85,7 +85,7 @@ int main(int argc, char *argv[])
#ifdef OPEN_DATASYNC_FLAG #ifdef OPEN_DATASYNC_FLAG
/* open_dsync, write */ /* open_dsync, write */
gettimeofday(&start_t, NULL); gettimeofday(&start_t, NULL);
if ((tmpfile = open("/var/tmp/test_fsync.out", O_RDWR | O_CREAT | O_DSYNC)) == -1) if ((tmpfile = open("/var/tmp/test_fsync.out", O_RDWR | O_CREAT | O_DSYNC, 0600)) == -1)
die("can't open /var/tmp/test_fsync.out"); die("can't open /var/tmp/test_fsync.out");
write(tmpfile, &strout, 200); write(tmpfile, &strout, 200);
close(tmpfile); close(tmpfile);
...@@ -98,7 +98,7 @@ int main(int argc, char *argv[]) ...@@ -98,7 +98,7 @@ int main(int argc, char *argv[])
/* open_fsync, write */ /* open_fsync, write */
gettimeofday(&start_t, NULL); gettimeofday(&start_t, NULL);
if ((tmpfile = open("/var/tmp/test_fsync.out", O_RDWR | O_CREAT | OPEN_SYNC_FLAG)) == -1) if ((tmpfile = open("/var/tmp/test_fsync.out", O_RDWR | O_CREAT | OPEN_SYNC_FLAG, 0600)) == -1)
die("can't open /var/tmp/test_fsync.out"); die("can't open /var/tmp/test_fsync.out");
write(tmpfile, &strout, 200); write(tmpfile, &strout, 200);
close(tmpfile); close(tmpfile);
...@@ -111,7 +111,7 @@ int main(int argc, char *argv[]) ...@@ -111,7 +111,7 @@ int main(int argc, char *argv[])
#ifdef HAVE_FDATASYNC #ifdef HAVE_FDATASYNC
/* write, fdatasync */ /* write, fdatasync */
gettimeofday(&start_t, NULL); gettimeofday(&start_t, NULL);
if ((tmpfile = open("/var/tmp/test_fsync.out", O_RDWR | O_CREAT)) == -1) if ((tmpfile = open("/var/tmp/test_fsync.out", O_RDWR | O_CREAT, 0600)) == -1)
die("can't open /var/tmp/test_fsync.out"); die("can't open /var/tmp/test_fsync.out");
write(tmpfile, &strout, 200); write(tmpfile, &strout, 200);
fdatasync(tmpfile); fdatasync(tmpfile);
...@@ -125,7 +125,7 @@ int main(int argc, char *argv[]) ...@@ -125,7 +125,7 @@ int main(int argc, char *argv[])
/* write, fsync, close */ /* write, fsync, close */
gettimeofday(&start_t, NULL); gettimeofday(&start_t, NULL);
if ((tmpfile = open("/var/tmp/test_fsync.out", O_RDWR | O_CREAT)) == -1) if ((tmpfile = open("/var/tmp/test_fsync.out", O_RDWR | O_CREAT, 0600)) == -1)
die("can't open /var/tmp/test_fsync.out"); die("can't open /var/tmp/test_fsync.out");
write(tmpfile, &strout, 200); write(tmpfile, &strout, 200);
fsync(tmpfile); fsync(tmpfile);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment