diff mbox series

[1/2] dio-writeback-race: fix missing mode in O_CREAT

Message ID 173992586628.4077946.5512645303623484204.stgit@frogsfrogsfrogs (mailing list archive)
State New
Headers show
Series [1/2] dio-writeback-race: fix missing mode in O_CREAT | expand

Commit Message

Darrick J. Wong Feb. 19, 2025, 12:49 a.m. UTC
From: Darrick J. Wong <djwong@kernel.org>

Fix this build error:

In file included from /usr/include/fcntl.h:314,
                 from dio-writeback-race.c:40:
In function 'open',
    inlined from 'main' at dio-writeback-race.c:110:7:
/usr/include/x86_64-linux-gnu/bits/fcntl2.h:50:11: error: call to '__open_missing_mode' declared with attribute error: open with O_CREAT or O_TMPFILE in second argument needs 3 arguments
   50 |           __open_missing_mode ();
      |           ^~~~~~~~~~~~~~~~~~~~~~

Cc: <fstests@vger.kernel.org> # v2025.02.16
Fixes: 17fb49493426ad ("fstests: add a generic test to verify direct IO writes with buffer contents change")
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
---
 src/dio-writeback-race.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Christoph Hellwig Feb. 19, 2025, 5:50 a.m. UTC | #1
Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>
diff mbox series

Patch

diff --git a/src/dio-writeback-race.c b/src/dio-writeback-race.c
index 963ed207fc1b6b..2d3156e5b0974a 100644
--- a/src/dio-writeback-race.c
+++ b/src/dio-writeback-race.c
@@ -107,7 +107,7 @@  int main (int argc, char *argv[])
 		fprintf(stderr, "failed to allocate aligned memory\n");
 		exit(EXIT_FAILURE);
 	}
-	fd = open(argv[optind], O_DIRECT | O_WRONLY | O_CREAT);
+	fd = open(argv[optind], O_DIRECT | O_WRONLY | O_CREAT, 0600);
 	if (fd < 0) {
 		fprintf(stderr, "failed to open file '%s': %m\n", argv[optind]);
 		goto error;