Skip to content

Commit 5483b2b

Browse files
committed
src/dio-offsets.c: fix compiler error of open()
The blktests build CI reported the error below: gcc -O2 -Wall -Wshadow -Werror -DHAVE_LINUX_BLKZONED_H -o dio-offsets dio-offsets.c In file included from /usr/include/fcntl.h:342, from dio-offsets.c:14: In function ‘open’, inlined from ‘init_args’ at dio-offsets.c:43:12, inlined from ‘main’ at dio-offsets.c:711:2: /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 (); | ^~~~~~~~~~~~~~~~~~~~~~ To avoid the error, remove the O_CREAT flag from the open() call. The flag should not be necessary because the open target file is the test target block device file which should exist. Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
1 parent f2a4323 commit 5483b2b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/dio-offsets.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ static int test_fd;
4040

4141
static void init_args(char **argv)
4242
{
43-
test_fd = open(argv[1], O_RDWR | O_CREAT | O_TRUNC | O_DIRECT);
43+
test_fd = open(argv[1], O_RDWR | O_TRUNC | O_DIRECT);
4444
if (test_fd < 0)
4545
err(errno, "%s: failed to open %s", __func__, argv[1]);
4646

0 commit comments

Comments
 (0)