Linux-Fsdevel Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] selftests: openat2: fix build error on newer glibc
@ 2020-02-13  7:26 Aleksa Sarai
  2020-02-13 20:10 ` shuah
  0 siblings, 1 reply; 2+ messages in thread
From: Aleksa Sarai @ 2020-02-13  7:26 UTC (permalink / raw)
  To: Shuah Khan; +Cc: linux-kselftest, linux-fsdevel, linux-kernel, Aleksa Sarai

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 <shuah@kernel.org>
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
---
 tools/testing/selftests/openat2/helpers.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/openat2/helpers.c b/tools/testing/selftests/openat2/helpers.c
index e9a6557ab16f..5074681ffdc9 100644
--- a/tools/testing/selftests/openat2/helpers.c
+++ b/tools/testing/selftests/openat2/helpers.c
@@ -46,7 +46,7 @@ int sys_renameat2(int olddirfd, const char *oldpath,
 
 int touchat(int dfd, const char *path)
 {
-	int fd = openat(dfd, path, O_CREAT);
+	int fd = openat(dfd, path, O_CREAT, 0700);
 	if (fd >= 0)
 		close(fd);
 	return fd;
-- 
2.25.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] selftests: openat2: fix build error on newer glibc
  2020-02-13  7:26 [PATCH] selftests: openat2: fix build error on newer glibc Aleksa Sarai
@ 2020-02-13 20:10 ` shuah
  0 siblings, 0 replies; 2+ messages in thread
From: shuah @ 2020-02-13 20:10 UTC (permalink / raw)
  To: Aleksa Sarai; +Cc: linux-kselftest, linux-fsdevel, linux-kernel, shuah

On 2/13/20 12:26 AM, Aleksa Sarai wrote:
> 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 <shuah@kernel.org>
> Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
> ---
>   tools/testing/selftests/openat2/helpers.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/openat2/helpers.c b/tools/testing/selftests/openat2/helpers.c
> index e9a6557ab16f..5074681ffdc9 100644
> --- a/tools/testing/selftests/openat2/helpers.c
> +++ b/tools/testing/selftests/openat2/helpers.c
> @@ -46,7 +46,7 @@ int sys_renameat2(int olddirfd, const char *oldpath,
>   
>   int touchat(int dfd, const char *path)
>   {
> -	int fd = openat(dfd, path, O_CREAT);
> +	int fd = openat(dfd, path, O_CREAT, 0700);
>   	if (fd >= 0)
>   		close(fd);
>   	return fd;
> 

Thanks for a quick patch. It compiles now.

I will take this through kselftest tree.

thanks,
-- Shuah



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-13  7:26 [PATCH] selftests: openat2: fix build error on newer glibc Aleksa Sarai
2020-02-13 20:10 ` shuah

Linux-Fsdevel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-fsdevel/0 linux-fsdevel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-fsdevel linux-fsdevel/ https://lore.kernel.org/linux-fsdevel \
		linux-fsdevel@vger.kernel.org
	public-inbox-index linux-fsdevel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-fsdevel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git