Skip to content

Commit 9a0584f

Browse files
cypharshuahkh
authored andcommitted
selftests: openat2: fix build error on newer glibc
It appears that newer glibcs check that openat(O_CREAT) was provided a fourth argument (rather than passing garbage), resulting in the following build error: > In file included from /usr/include/fcntl.h:301, > from helpers.c:9: > In function 'openat', > inlined from 'touchat' at helpers.c:49:11: > /usr/include/x86_64-linux-gnu/bits/fcntl2.h:126:4: error: call to > '__openat_missing_mode' declared with attribute error: openat with O_CREAT > or O_TMPFILE in third argument needs 4 arguments > 126 | __openat_missing_mode (); > | ^~~~~~~~~~~~~~~~~~~~~~~~ Reported-by: Shuah Khan <[email protected]> Signed-off-by: Aleksa Sarai <[email protected]> Tested-by: Shuah Khan <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
1 parent 3e83936 commit 9a0584f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/testing/selftests/openat2/helpers.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ int sys_renameat2(int olddirfd, const char *oldpath,
4646

4747
int touchat(int dfd, const char *path)
4848
{
49-
int fd = openat(dfd, path, O_CREAT);
49+
int fd = openat(dfd, path, O_CREAT, 0700);
5050
if (fd >= 0)
5151
close(fd);
5252
return fd;

0 commit comments

Comments
 (0)