diff options
author | Jeff Layton <jlayton@redhat.com> | 2018-04-27 12:34:59 -0400 |
---|---|---|
committer | Eryu Guan <guaneryu@gmail.com> | 2018-05-02 10:53:48 +0800 |
commit | 0c2896508f44a61431d0dee9257154adc3c42561 (patch) | |
tree | 61d6e67969de8431c2db4759c66bc230bd421cc3 | |
parent | 7bc26faa6b52a2035f659c90a2833a453a18bace (diff) | |
download | xfstests-dev-0c2896508f44a61431d0dee9257154adc3c42561.tar.gz |
src/fsync-err: don't truncate files on second open
...and no need for O_CREAT flag.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
-rw-r--r-- | src/fsync-err.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/fsync-err.c b/src/fsync-err.c index 146688ddb0..bd05dcc0a8 100644 --- a/src/fsync-err.c +++ b/src/fsync-err.c @@ -170,9 +170,9 @@ int main(int argc, char **argv) ret = fsync(fd[i]); if (ret < 0) { /* - * We did a failed write and fsync on each fd before. - * Now the error should be clear since we've not done - * any writes since then. + * We did a failed write and fsync on each fd + * before. Now the error should be clear since + * we've not done any writes since then. */ printf("Third fsync on fd[%d] failed: %m\n", i); return 1; @@ -220,7 +220,7 @@ int main(int argc, char **argv) printf("Close of fd[%d] returned unexpected error: %m\n", i); return 1; } - fd[i] = open(fname, O_WRONLY | O_CREAT | O_TRUNC, 0644); + fd[i] = open(fname, O_WRONLY, 0644); if (fd[i] < 0) { printf("Second open of fd[%d] failed: %m\n", i); return 1; |