Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit69138a9

Browse files
committed
Add permission mode to opens().
1 parentbfaa9a0 commit69138a9

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

‎src/tools/fsync/test_fsync.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ int main(int argc, char *argv[])
3939
printf("Simple write timing:\n");
4040
/* write only */
4141
gettimeofday(&start_t,NULL);
42-
if ((tmpfile=open("/var/tmp/test_fsync.out",O_RDWR |O_CREAT))==-1)
42+
if ((tmpfile=open("/var/tmp/test_fsync.out",O_RDWR |O_CREAT,0600))==-1)
4343
die("can't open /var/tmp/test_fsync.out");
4444
write(tmpfile,&strout,200);
4545
close(tmpfile);
@@ -52,7 +52,7 @@ int main(int argc, char *argv[])
5252
printf("Compare fsync before and after write's close:\n");
5353
/* write, fsync, close */
5454
gettimeofday(&start_t,NULL);
55-
if ((tmpfile=open("/var/tmp/test_fsync.out",O_RDWR |O_CREAT))==-1)
55+
if ((tmpfile=open("/var/tmp/test_fsync.out",O_RDWR |O_CREAT,0600))==-1)
5656
die("can't open /var/tmp/test_fsync.out");
5757
write(tmpfile,&strout,200);
5858
fsync(tmpfile);
@@ -65,12 +65,12 @@ int main(int argc, char *argv[])
6565

6666
/* write, close, fsync */
6767
gettimeofday(&start_t,NULL);
68-
if ((tmpfile=open("/var/tmp/test_fsync.out",O_RDWR |O_CREAT))==-1)
68+
if ((tmpfile=open("/var/tmp/test_fsync.out",O_RDWR |O_CREAT,0600))==-1)
6969
die("can't open /var/tmp/test_fsync.out");
7070
write(tmpfile,&strout,200);
7171
close(tmpfile);
7272
/* reopen file */
73-
if ((tmpfile=open("/var/tmp/test_fsync.out",O_RDWR |O_CREAT))==-1)
73+
if ((tmpfile=open("/var/tmp/test_fsync.out",O_RDWR |O_CREAT,0600))==-1)
7474
die("can't open /var/tmp/test_fsync.out");
7575
fsync(tmpfile);
7676
close(tmpfile);
@@ -85,7 +85,7 @@ int main(int argc, char *argv[])
8585
#ifdefOPEN_DATASYNC_FLAG
8686
/* open_dsync, write */
8787
gettimeofday(&start_t,NULL);
88-
if ((tmpfile=open("/var/tmp/test_fsync.out",O_RDWR |O_CREAT |O_DSYNC))==-1)
88+
if ((tmpfile=open("/var/tmp/test_fsync.out",O_RDWR |O_CREAT |O_DSYNC,0600))==-1)
8989
die("can't open /var/tmp/test_fsync.out");
9090
write(tmpfile,&strout,200);
9191
close(tmpfile);
@@ -98,7 +98,7 @@ int main(int argc, char *argv[])
9898

9999
/* open_fsync, write */
100100
gettimeofday(&start_t,NULL);
101-
if ((tmpfile=open("/var/tmp/test_fsync.out",O_RDWR |O_CREAT |OPEN_SYNC_FLAG))==-1)
101+
if ((tmpfile=open("/var/tmp/test_fsync.out",O_RDWR |O_CREAT |OPEN_SYNC_FLAG,0600))==-1)
102102
die("can't open /var/tmp/test_fsync.out");
103103
write(tmpfile,&strout,200);
104104
close(tmpfile);
@@ -111,7 +111,7 @@ int main(int argc, char *argv[])
111111
#ifdefHAVE_FDATASYNC
112112
/* write, fdatasync */
113113
gettimeofday(&start_t,NULL);
114-
if ((tmpfile=open("/var/tmp/test_fsync.out",O_RDWR |O_CREAT))==-1)
114+
if ((tmpfile=open("/var/tmp/test_fsync.out",O_RDWR |O_CREAT,0600))==-1)
115115
die("can't open /var/tmp/test_fsync.out");
116116
write(tmpfile,&strout,200);
117117
fdatasync(tmpfile);
@@ -125,7 +125,7 @@ int main(int argc, char *argv[])
125125

126126
/* write, fsync, close */
127127
gettimeofday(&start_t,NULL);
128-
if ((tmpfile=open("/var/tmp/test_fsync.out",O_RDWR |O_CREAT))==-1)
128+
if ((tmpfile=open("/var/tmp/test_fsync.out",O_RDWR |O_CREAT,0600))==-1)
129129
die("can't open /var/tmp/test_fsync.out");
130130
write(tmpfile,&strout,200);
131131
fsync(tmpfile);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp