From: Jeff Layton <jlayton@kernel.org>
To: fstests@vger.kernel.org, eguan@redhat.com
Subject: [PATCH] fsync-err: don't truncate files on second open
Date: Fri, 27 Apr 2018 12:34:59 -0400 [thread overview]
Message-ID: <20180427163459.20864-1-jlayton@kernel.org> (raw)
From: Jeff Layton <jlayton@redhat.com>
...and no need for O_CREAT flag.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
---
src/fsync-err.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/fsync-err.c b/src/fsync-err.c
index 146688ddb01e..bd05dcc0a898 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;
--
2.14.3
reply other threads:[~2018-04-27 16:35 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180427163459.20864-1-jlayton@kernel.org \
--to=jlayton@kernel.org \
--cc=eguan@redhat.com \
--cc=fstests@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox