public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fsync-err: don't truncate files on second open
@ 2018-04-27 16:34 Jeff Layton
  0 siblings, 0 replies; only message in thread
From: Jeff Layton @ 2018-04-27 16:34 UTC (permalink / raw)
  To: fstests, eguan

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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-04-27 16:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-27 16:34 [PATCH] fsync-err: don't truncate files on second open Jeff Layton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox